diff --git a/hal/socket/win32/socket_win32.c b/hal/socket/win32/socket_win32.c index a59f0f5a..122f6a78 100644 --- a/hal/socket/win32/socket_win32.c +++ b/hal/socket/win32/socket_win32.c @@ -279,6 +279,8 @@ ServerSocket_accept(ServerSocket self) conSocket = (Socket) GLOBAL_CALLOC(1, sizeof(struct sSocket)); conSocket->fd = fd; + socketCount++; + setSocketNonBlocking(conSocket); } @@ -305,6 +307,9 @@ TcpSocket_create() { Socket self = NULL; + if (wsaStartUp() == false) + return NULL; + int sock = socket(AF_INET, SOCK_STREAM, 0); if (sock != INVALID_SOCKET) { @@ -334,9 +339,6 @@ Socket_connect(Socket self, const char* address, int port) { struct sockaddr_in serverAddress; - if (wsaStartUp() == false) - return false; - if (!prepareServerAddress(address, port, &serverAddress)) return false;