Skip to content

Commit

Permalink
not setting SO_REUSEADDR on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
valenok committed Sep 6, 2010
1 parent fa303bc commit 3970407
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mongoose.c
Expand Up @@ -1559,8 +1559,11 @@ static SOCKET mg_open_listening_port(struct mg_context *ctx, const char *str,
usa->u.sin.sin_port = htons((uint16_t) port);

if ((sock = socket(PF_INET, SOCK_STREAM, 6)) != INVALID_SOCKET &&
#if !defined(_WIN32)
// On windows, SO_REUSEADDR is recommended only for broadcast UDP sockets
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
(char *) &on, sizeof(on)) == 0 &&
#endif // !_WIN32
bind(sock, &usa->u.sa, usa->len) == 0 &&
listen(sock, 20) == 0) {
// Success
Expand Down

0 comments on commit 3970407

Please sign in to comment.