⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ftpget.h

📁 此程式利用ftp與http協定提供多線程下載及斷點續傳功能
💻 H
字号:
// FtpGet.h: CFtpGet类定义.
//
#ifndef _FTPGET_H__INCLUDED
#define _FTPGET_H__INCLUDED

class CFtpSect
{
public:
    CString  szHostAddr;     // Host名.
    CString  szUserName;     // 用户名.
    CString  szPassword;     // 密码.
    int      nPort;          // 端口号.
    CString szFtpFilename;   // Ftp文件名.
    CString szDesFilename;   // 下载后的文件名.
	DWORD  nStart;           // 分割的起始位置.
    DWORD  nEnd;             // 分割的起始位置.
	DWORD  bPasvMode;        // 下载模态. 
};

class CFtpGet  
{
public:
	CFtpGet();
	virtual ~CFtpGet();

private:
	CFtpSect *sectinfo;
	static int m_nCount;
	static UINT ThreadDownLoad(void* pParam);

private:
	static	UINT GetCode(CString revStr);
	static	BOOL SetFilePos(SOCKET hCtrlSock,DWORD pos);
	static	DWORD GetFtpFileSize(SOCKET hCtrlSock ,CString fileName);
	static	SOCKET InitPortConn(SOCKET hCtrlSock);
	BOOL FileCombine(CFtpSect *pInfo, FILE *fpwrite);

public:
	static	CString QueueFtpCmd
		(SOCKET hSock,CString strCmd, CString strDescr=_T(""));
	static CString GetHost(CString pasvStr);
	static int GetPort(CString pasvStr);
	static	SOCKET ConnectFtp
		(CString host ,int port, CString userName ,CString  pass);

	void DirList(SOCKET hCtrlSock,BOOL bPasvMode=TRUE);

	BOOL FtpDownLoad(
			CString strHostAddr, 
			int nPort, 
			CString strUserName ,
			CString  strPassword,
			CString strFtpFileName,
			CString strWriteFileName,
			int nSectNum, 
			BOOL bPasvMode=TRUE);
};

#endif 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -