www.pudn.com > ftp.rar > zhuftp.h


#ifndef ZHUFTP_H_
#define ZHUFTP_H_


#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#define FTP_DISCONNECTED 	0
#define FTP_CONECTED		1
#define FTP_TRANSING		2
#define FTP_STOPPING		3

typedef struct 
{
	char prior[12];
	int usern;
	char username[32];
	char groupname[32];
	int filesize;
	char date[4];
	int day;
	char time[8];
	char filename[40];
}ftpfiledis;
class FtpZhu
{
	struct sockaddr_in cmdaddr;
	int FtpStatus;//0,disconnected,1,connected,2,downloading
	int CmdSocket;
	int Timeout;
	time_t lasttime;
	char recvbuffer[512];
	int SendFtpCommand(int sockfd,const char*cmd);
	int CheckTime(int flag,int interval);
public:
	FtpZhu();
	~FtpZhu();	
	int ConnectServer(const char *ServerIp,const char*uname,const char*password);
	int GetFile(const char *remotepath,const char *localpath,const char *filename);
	int PutFile(const char *remotepath,const char *localpath,const char* filename);
	int CheckTime(int flag);
	void SetTimeout(int interval);
	int Disconnect();
	int GetFtpStatus();
};
#endif