static bool Init()
{
unsigned short wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD( 2,2 );
err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 )
return false;
if ( LOBYTE( wsaData.wVersion ) != 2 ||
HIBYTE( wsaData.wVersion ) != 2 )
{
WSACleanup( );
return false;
}
return true;
}
static bool Exit()
{
WSACleanup( );
return true;
{
unsigned short wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD( 2,2 );
err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 )
return false;
if ( LOBYTE( wsaData.wVersion ) != 2 ||
HIBYTE( wsaData.wVersion ) != 2 )
{
WSACleanup( );
return false;
}
return true;
}
static bool Exit()
{
WSACleanup( );
return true;
}
两个函数,分别在InitInstance 中开始调用和 ExitInstance中调用