diff --git a/src/c/tcp.d b/src/c/tcp.d index 233cb581e..5fd61a41c 100644 --- a/src/c/tcp.d +++ b/src/c/tcp.d @@ -137,7 +137,11 @@ int connect_to_server(char *host, int port) #endif start_critical_section(); if (connect(fd, addr, addrlen) == -1) { +#if defined(_MSC_VER) || defined(mingw32) + closesocket(fd); +#else (void) close (fd); +#endif end_critical_section(); return(0); /* errno set by system call. */ }