当前位置导航:炫浪网>>网络学院>>编程开发>>C++教程>>Visual C++教程

重叠I/O模型写的一个CNet类

类头如下:
class CNet 
{
public:
 static BOOL Close(SOCKET &socket);
 static BOOL Close(TSOCKET &ts);
 static int Receive(TSOCKET &socket , LPVOID lpData, DWORD dwSize , DWORD dwTimeout = INFINITE);
 static int Send(TSOCKET &socket, LPVOID lpData, DWORD dwSize, DWORD dwTimeOut = INFINITE);
 static BOOL StartUp();
 static bool StartListen(TSOCKET &ts , short sListenPort);
 CNet();
 virtual ~CNet();
 static int Connect(TSOCKET &ts , LPSTR lpServerAddr, short sPort);
 static int Connect(TSOCKET &ts , LPSTR lpServerAddr, short sPort , STRUCT_PROXY &ProxyInfo);
 static BOOL SetSocketOpt(SOCKET &s , int iBuffSize = BUFFERSIZE);

 static int SendEx(SOCKET &socket, WSABUF **buf, DWORD dwBufCount, DWORD dwTimeOut);
 static int ReceiveEx(SOCKET &socket , WSABUF **buf, DWORD dwBufCount , DWORD dwTimeout);
};

相关内容
赞助商链接