网络编程初始化类 CInitSock

网络编程初始化类


#include 
#pragma comment(lib, "ws2_32.lib")

class CInitSock
{
public:
	CInitSock(BYTE minorVer=2, BYTE majorVer=2)
	{
		WORD wVersionRequested = MAKEWORD(minorVer, majorVer);
		WSADATA wsaData;
		if (0 != ::WSAStartup(wVersionRequested, &wsaData))
		{
			exit(0);
		}

	}
	~CInitSock()
	{
		::WSACleanup();
	}
};




你可能感兴趣的:(网络编程初始化类 CInitSock)