类头如下:
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);
};
代码下载地址:http://mybios.w145.west263.cn/temp/CNetTest.rar
如代码有错误请专家们指正!!