Browse Source

Socket change to provide consistent re-use behaviour on posix and Windows.

tags/2021-05-28
jules 11 years ago
parent
commit
91e6d9a35a
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      modules/juce_core/network/juce_Socket.cpp

+ 2
- 0
modules/juce_core/network/juce_Socket.cpp View File

@@ -418,8 +418,10 @@ bool StreamingSocket::createListener (const int newPortNumber, const String& loc
if (handle < 0)
return false;
#if ! JUCE_WINDOWS // on windows, adding this option produces behaviour different to posix
const int reuse = 1;
setsockopt (handle, SOL_SOCKET, SO_REUSEADDR, (const char*) &reuse, sizeof (reuse));
#endif
if (bind (handle, (struct sockaddr*) &servTmpAddr, sizeof (struct sockaddr_in)) < 0
|| listen (handle, SOMAXCONN) < 0)


Loading…
Cancel
Save