I want to know the windows' winsock version, 1.1 or 2.0. Which API can I use?
Printable View
I want to know the windows' winsock version, 1.1 or 2.0. Which API can I use?
You can tell by using WSAStartup. Since you are asking for a specific version, you can ask for version 2.0. You must check the result and make sure there is no error. In case of an incorrect version you will get "WSAVERNOTSUPPORTED". You get the current version in the WSAData.
Example:
result = WSAStartup(ver,&WSAData);
if ( result!=0 )
if ( result == WSAVERNOTSUPPORTED ) {
// failed due to incorrect version.
// WSAData.wVersion contains the version using LO/HI WORD.
}
bye,
Amir.