WORD winsock_ver; WSADATA wsadata;  winsock_ver = MAKEWORD(2, 0); winsock_module = LoadLibrary("WS2_32.DLL"); if (!winsock_module) { winsock_module = LoadLibrary("WSOCK32.DLL"); winsock_ver = MAKEWORD(1, 1); } if (!winsock_module) fatalbox("Unable to load any WinSock library");  GET_WINSOCK_FUNCTION(WSAAsyncSelect); GET_WINSOCK_FUNCTION(WSAEventSelect); GET_WINSOCK_FUNCTION(select); GET_WINSOCK_FUNCTION(WSAGetLastError); GET_WINSOCK_FUNCTION(WSAEnumNetworkEvents); GET_WINSOCK_FUNCTION(WSAStartup); GET_WINSOCK_FUNCTION(WSACleanup); GET_WINSOCK_FUNCTION(closesocket); GET_WINSOCK_FUNCTION(ntohl); GET_WINSOCK_FUNCTION(htonl); GET_WINSOCK_FUNCTION(htons); GET_WINSOCK_FUNCTION(ntohs); GET_WINSOCK_FUNCTION(gethostbyname); GET_WINSOCK_FUNCTION(getservbyname); GET_WINSOCK_FUNCTION(inet_addr); GET_WINSOCK_FUNCTION(inet_ntoa); GET_WINSOCK_FUNCTION(connect); GET_WINSOCK_FUNCTION(bind); GET_WINSOCK_FUNCTION(setsockopt); GET_WINSOCK_FUNCTION(socket); GET_WINSOCK_FUNCTION(listen); GET_WINSOCK_FUNCTION(send); GET_WINSOCK_FUNCTION(ioctlsocket); GET_WINSOCK_FUNCTION(accept); GET_WINSOCK_FUNCTION(recv);  if (p_WSAStartup(winsock_ver, &wsadata)) { fatalbox("Unable to initialise WinSock"); } if (LOBYTE(wsadata.wVersion) != LOBYTE(winsock_ver)) { p_WSACleanup(); fatalbox("WinSock version is incompatible with %d.%d", LOBYTE(winsock_ver), HIBYTE(winsock_ver)); }
void sk_init(void){    sktree = newtree234(cmpfortree);}