tcpserverdlg.h

来自「在mobile下两个终端tcp无线连接」· C头文件 代码 · 共 53 行

H
53
字号
// TCPServerDlg.h : 头文件
//

#pragma once
#include "TCPServer_CE.h"
#include "TCPCustom_CE.h"
// CTCPServerDlg 对话框
class CTCPServerDlg : public CDialog
{
// 构造
public:
	CTCPServerDlg(CWnd* pParent = NULL);	// 标准构造函数

// 对话框数据
	enum { IDD = IDD_TCPSERVER_DIALOG };


	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV 支持

// 实现
protected:
	HICON m_hIcon;

	// 生成的消息映射函数
	virtual BOOL OnInitDialog();
	afx_msg void OnBtnlisten();
	afx_msg void OnBtnclose();
#if defined(_DEVICE_RESOLUTION_AWARE) && !defined(WIN32_PLATFORM_WFSP)
	afx_msg void OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/);
#endif
	DECLARE_MESSAGE_MAP()
public:
	int		m_localPort;
private:
	//定义CTCPServer_CE对象
	CTCPServer_CE m_tcpServer;
private:
	//客户端连接建立事件处理函数
	static void CALLBACK	OnClientConnect(CWnd* pWnd,CTCPCustom_CE *pTcpCustom);
	//客户端SOCKET关闭事件处理函数
	static void  CALLBACK OnClientClose(CWnd* pWnd,CTCPCustom_CE*pTcpCustom);
	//服务器端收到来自客户端的数据
	static  void CALLBACK OnClientRead(CWnd* pWnd,CTCPCustom_CE* pTcpCustom,const char * buf,int len );
	//客户端Socket错误事件处理函数
	static  void CALLBACK OnClientError(CWnd* pWnd,CTCPCustom_CE* pTcpCustom,int nErrorCode);

	//服务器端Socket错误事件处理函数
	static void CALLBACK OnServerError(CWnd* pWnd,CTCPServer_CE* pTcpServer_CE,int nErrorCode);

	afx_msg void OnBnClickedBtnsend();
};

⌨️ 快捷键说明

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