Use net_close() to close sockets
So that it also works on Windows.
@@ -33,7 +33,7 @@ net_connect(uint32_t addr, uint16_t port) {
if (connect(sock, (SOCKADDR *) &sin, sizeof(sin)) == SOCKET_ERROR) {
perror("connect");
- close(sock);
+ net_close(sock);
return INVALID_SOCKET;
}
@@ -61,13 +61,13 @@ net_listen(uint32_t addr, uint16_t port, int backlog) {
if (bind(sock, (SOCKADDR *) &sin, sizeof(sin)) == SOCKET_ERROR) {
perror("bind");
- close(sock);
+ net_close(sock);
return INVALID_SOCKET;
}
if (listen(sock, backlog) == SOCKET_ERROR) {
perror("listen");
- close(sock);
+ net_close(sock);
return INVALID_SOCKET;
}
