udp.h

来自「UDP套接字编程 很好的程序 大家运行一下」· C头文件 代码 · 共 64 行

H
64
字号
#if !defined(AFX_UDP_H__DD70BE48_5F9E_401E_B2E8_6BEC761E9A69__INCLUDED_)
#define AFX_UDP_H__DD70BE48_5F9E_401E_B2E8_6BEC761E9A69__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// UDP.h : header file
//



/////////////////////////////////////////////////////////////////////////////
// CUDP command target
typedef struct tagUDPPackage
{
	char ip[32];
	unsigned int port;
	int len;
	unsigned char *pData;
} UDPPackage;
#define MAX_BUFFER_NUM 2
class CUDP : public CAsyncSocket
{
// Attributes
public:

// Operations
public:
	CUDP(CWnd* pWnd=NULL,UINT UserMessageID=WM_USER+1,int MaxPackageSize=16384);
	virtual ~CUDP();

// Overrides
public:
	CString GetHostIP();
	CRITICAL_SECTION UDPCriticalSection;
	int m_Index;
	UDPPackage m_Udp_Buffer[MAX_BUFFER_NUM];
	int m_MaxPackageSize;
	UINT m_UserMessageID;
	CWnd* m_pWnd;

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CUDP)
	public:
	virtual void OnReceive(int nErrorCode);
	virtual void OnSend(int nErrorCode);
	//}}AFX_VIRTUAL

	// Generated message map functions
	//{{AFX_MSG(CUDP)
		// NOTE - the ClassWizard will add and remove member functions here.
	//}}AFX_MSG

// Implementation
protected:
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_UDP_H__DD70BE48_5F9E_401E_B2E8_6BEC761E9A69__INCLUDED_)

⌨️ 快捷键说明

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