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

📄 tcpserver_ft.h

📁 文件传输代码
💻 H
字号:
// TCPServer_FT.h: interface for the CTCPServer_FT class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_TCPSERVER_FT_H__B759191D_7D83_4AE0_9AEB_1BD3E3B88EBA__INCLUDED_)
#define AFX_TCPSERVER_FT_H__B759191D_7D83_4AE0_9AEB_1BD3E3B88EBA__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define			WM_BINDERROR		WM_USER + 1001		//绑定失败
#define			WM_LISTENERROR		WM_USER + 1002		//监听失败
#define			WM_STARTLISTEN		WM_USER + 1003   	//开始监听
#define			WM_SENDFILELIST		WM_USER + 1004   	//发送文件列表

#define			FILELIST		    1000				//请求文件列表
#define			FILEDATA			2000				//请求文件数据

#define			SENDSIZE			1024*16				//一次性发送/接收的数据块大小

//客户端与服务器通信语言结构
typedef struct
{
	int  iCommand;
	long lFileOffset;
	long lFileLength;
	char sClientPath[128];
	char sServerPath[128];
}MSGREQUEST;

//文件列表结构
typedef struct
{
	long lFileLength;
	char sServerPath[128];
}MSGFILELIST;

//接收线程参数
typedef struct
{
	SOCKET sock;
	LPVOID ptr;
}PARAMRECV;

class CTCPServer_FT  
{
public:
	CTCPServer_FT();
	virtual ~CTCPServer_FT();
	//filename
	CString m_strFileName;

	//重载构造函数
	CTCPServer_FT(CString strFileNme, LPVOID ptr);

	//设置监听端口
	void SetListenPort(int iPort);

	//开始监听文件请求
	void ListenRequest(void);

	//停止监听
	void StopListen(void);
	void SetFileName(CString strFileName);

	//监听线程
	static DWORD WINAPI ThreadListen(LPVOID lpParam);

	//接收线程
	static DWORD WINAPI ThreadRecv(LPVOID lpParam);

private:
	//监听线程结束符
	BOOL m_bEndListenThread;

	//监听端口
	int m_iListenPort;

	//窗口指针
	CWnd* m_pWnd;
};

#endif // !defined(AFX_TCPSERVER_FT_H__B759191D_7D83_4AE0_9AEB_1BD3E3B88EBA__INCLUDED_)

⌨️ 快捷键说明

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