📄 2003-01-03_cwinsock.h
字号:
// CWinsock.h
// Socket wrapper for windows (winsock) by Jan Krumsiek
#ifndef _CWINSOCK_H_
#define _CWINSOCK_H_
#pragma warning(disable:4786)
#include "winsock.h"
#include "CSocket.h"
#include "proxymain.h"
#include <map>
#define WM_WSKEVENT (WM_USER + 43)
//typedef void (*t_sig)(int); // Signal handler
void StartSockets();
void StopSockets();
class CWinsock;
//
typedef std::map<HWND, CWinsock*> SOCKOBJMAP;
typedef std::map<HWND, CWinsock*>* SOCKOBJMAPPTR;
// Class declaration
class CWinsock : public CSocket
{
protected: // Private members
// private member variables
SOCKET listensock; // Socket that we are currently listing on
// event handlers
t_data arrivalhandler;
t_error errorhandler;
t_accept accepthandler;
t_close closehandler;
t_connect connecthandler;
static LRESULT CALLBACK WndProc( // Event handler for winsock
HWND hwnd, // handle of window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
SOCKET CreateSocket(); // Creates a socket
public: // Public members
HWND hwnd; // Handle to event window
CWinsock(); // Constructor
~CWinsock(); // Destructor
// Functions
UINT Connect(CHARPTR host, USHORT port);
UINT Listen(UINT port);
void Close(UINT socket);
Send(UINT socket, CHARPTR data, UINT length);
Sendsz(UINT socket, CHARPTR data);
CHARPTR GetPeerIP(UINT socket);
SetEventHandlers(t_connect connproc, t_accept acceptproc,
t_close closeproc, t_data arrivalproc,
t_error errorproc);
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -