DCHK Client Version 0.5.7 - Documentation |
![]() |
On Microsoft Windows it is necessary to initialize the windows socket API before you can use any socket functionality. This is done by calling the WSAStartup-function.
The following example shows how to call WSAStartup:
#include <winsock2.h> ... WORD wVersionRequested; WSADATA wsaData; int err; wVersionRequested = MAKEWORD( 2, 2 ); // desired winsock version 2.2 err = WSAStartup( wVersionRequested, &wsaData ); if (err!=0) { // Handle error } else { // everything is fine, you can continue }
You can call the irislwz_InitWSA function of the DCHK library to do this for you. You should call the function as early as possible before you start any additional threads.
When linking the program you have to add Ws2_32.lib and Dnsapi.lib as additional libraries.