Mercurial > hg > nnchat
changeset 10:53e127854dca
WinSock support fixes.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 22 Mar 2008 00:55:03 +0000 |
parents | a02659cc5bc8 |
children | 707e35b03f89 |
files | nnchat.c |
diffstat | 1 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/nnchat.c Thu Mar 20 05:13:00 2008 +0000 +++ b/nnchat.c Sat Mar 22 00:55:03 2008 +0000 @@ -654,6 +654,16 @@ } } +#ifdef __WIN32 + { + WSADATA wsaData; + if (WSAStartup(MAKEWORD(2, 0), &wsaData) != 0) { + THERR("WinSock API v2.0 not supported.\n"); + return -20; + } + } +#endif + /* Okay ... */ THMSG(1, "Trying to resolve host '%s' ...\n", optServer); tmpHost = gethostbyname(optServer); @@ -767,7 +777,13 @@ /* .. */ th_free(optUserName2); + +#ifdef __WIN32 + closesocket(tmpSocket); + WSACleanup(); +#else close(tmpSocket); +#endif if (optLogFile) { THMSG(1, "Closing logfile.\n");