📄 networkdlg.h
字号:
// NetworkDlg.h : header file
//
#if !defined(AFX_NETWORKDLG_H__E331D79F_A21E_432E_AF22_C0601D90390D__INCLUDED_)
#define AFX_NETWORKDLG_H__E331D79F_A21E_432E_AF22_C0601D90390D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <winsock.h>
#pragma comment(lib, "wsock32.lib")
#pragma message("Automatically linking with wsock32.dll")
#define US_SOCK (WM_USER + 200)
#define US_UDP_SOCK (WM_USER + 201)
#define US_CONNECT_SOCK (WM_USER + 202)
struct SOCKLOG
{
SOCKET socket;
char name[30];
char ip[20];
struct SOCKLOG * next;
};
/////////////////////////////////////////////////////////////////////////////
// CNetworkDlg dialog
class CNetworkDlg : public CDialog
{
// Construction
public:
CNetworkDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CNetworkDlg)
enum { IDD = IDD_NETWORK_DIALOG };
CIPAddressCtrl m_TcpIp;
CIPAddressCtrl m_UdpIp;
CEdit m_RecvInfo;
//}}AFX_DATA
public:
WORD wVersionRequested;
SOCKET sock_listen; //listen socket
SOCKET sock_udp; //udp DGRAM socket
SOCKET sock_connect; //connect socket
char connect_host[50];
SOCKLOG * sock_client; //client log socket list
BYTE databuf[2048];
public:
BOOL InitSocket(void);
void UninitSocket(void);
/* use TCP protocol */
BOOL Connect(char *ip);
BOOL Disconnect(void);
int Send(BYTE *buf, int len);
int Reply(char *ip, BYTE *buf, int len);
/* use UDP protocol */
int Broadcast(BYTE *buf, int len);
int SendTo(char *ip, BYTE *buf, int len);
void DealWithNetComm(UINT uId, char *ip, BYTE *buf, DWORD len);
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNetworkDlg)
public:
virtual BOOL DestroyWindow();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CNetworkDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnListenSockMessage(WPARAM wParam, LPARAM lParam);
afx_msg void OnUdpSockMessage(WPARAM wParam, LPARAM lParam);
afx_msg void OnConnectSockMessage(WPARAM wParam, LPARAM lParam);
afx_msg void OnBroadcast();
afx_msg void OnUdpSend();
afx_msg void OnTcpLink();
afx_msg void OnTcpDisconnect();
afx_msg void OnTcpSend();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_NETWORKDLG_H__E331D79F_A21E_432E_AF22_C0601D90390D__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -