fix for win32 (need to init winsock)

This commit is contained in:
Bill Currie 2001-10-21 00:48:38 +00:00
parent d69c8013aa
commit cc89fb23c8

View file

@ -226,6 +226,9 @@ QW_Master (struct sockaddr_in *addr)
server_t *servers; server_t *servers;
int serverlen = SLIST_MULTIPLE; int serverlen = SLIST_MULTIPLE;
int i; int i;
#ifdef _WIN32
WSADATA winsockdata;
#endif
servers = malloc (sizeof (server_t) * serverlen); servers = malloc (sizeof (server_t) * serverlen);
if (!servers) { if (!servers) {
@ -236,6 +239,14 @@ QW_Master (struct sockaddr_in *addr)
for (i = 0; i < serverlen; i++) for (i = 0; i < serverlen; i++)
servers[i].updated = 0; servers[i].updated = 0;
#ifdef _WIN32
i = WSAStartup (MAKEWORD (1, 1), &winsockdata);
if (i) {
printf ("Winsock initialization failed.\n");
return;
}
#endif
sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (sock < 0) { if (sock < 0) {
printf ("socket failed\n"); printf ("socket failed\n");