diff --git a/mongoose.c b/mongoose.c
index a17d1e4573923769ff79a61a34350e609be64051..5b715c010ffb8cbbd937bcd41b9f7bc2113239ab 100644
--- a/mongoose.c
+++ b/mongoose.c
@@ -4693,7 +4693,7 @@ struct mg_connection *mg_connect(const char *host, int port, int use_ssl,
   struct mg_connection *conn = NULL;
   struct sockaddr_in sin;
   struct hostent *he;
-  int sock;
+  SOCKET sock;
 
   if (host == NULL) {
     snprintf(ebuf, ebuf_len, "%s", "NULL host");