[zeromq-dev] Any way to flush or clear or manage ports?

Martin Sustrik sustrik at 250bpm.com
Sun Sep 4 09:52:37 CEST 2011


On 09/04/2011 08:55 AM, Elliot Saba wrote:
> Hello, Marc, in addition, I suggest you read up on the SO_REUSEADDR (On
> linux, there is also a SO_REUSEPORT option, but SO_REUSEADDR should do
> the same thing on windows) socket option, and if that looks like your
> problem, maybe try modifying the sources to use that option when
> creating a socket.

The following code is responsible for tuning the listening socket:

     //  Allow reusing of the address.
     int flag = 1;
#ifdef ZMQ_HAVE_WINDOWS
     rc = setsockopt (s, SOL_SOCKET, SO_EXCLUSIVEADDRUSE,
         (const char*) &flag, sizeof (int));
     wsa_assert (rc != SOCKET_ERROR);
#else
     rc = setsockopt (s, SOL_SOCKET, SO_REUSEADDR, &flag, sizeof (int));
     errno_assert (rc == 0);
#endif


I guess the WINDOWS part may be wrong.

Can anyone with win experience comment?

Martin



More information about the zeromq-dev mailing list