diff --git a/vlib/net/socket.v b/vlib/net/socket.v index 5f5009a9d3..2a1c77bad6 100644 --- a/vlib/net/socket.v +++ b/vlib/net/socket.v @@ -90,7 +90,7 @@ pub fn new_socket(family int, _type int, proto int) ?Socket { // This is needed so that there are no problems with reusing the // same port after the application exits. C.setsockopt(sockfd, C.SOL_SOCKET, C.SO_REUSEADDR, &one, sizeof(int)) - if sockfd == 0 { + if sockfd == -1 { return error('net.socket: failed') } s := Socket{