[omniORB] Port allocation problem on windows (incl. patch)

Duncan Grisby duncan at grisby.org
Thu May 6 18:08:51 BST 2010


On Wed, 2010-04-14 at 12:43 +0200, Hannes Lerchl wrote:

> Windows has a fundamentally different understanding of the socket
>  option SO_REUSEADDR than posix systems:
>
> Instead of immediately reusing the port after program termination the
>  socket is free for reuse even if another program is still using it.
>  The outcome is undefined and most probably both applications are
>  unhappy (for our application this meant that further communication was
>  impossible without any of the two applications knowing what went
>  wrong).

Sadly, like Posix systems, Windows needs SO_REUSEADDR to allow a server
that has terminated unexpectedly to restart using the same port. There
is no way to allow that on Windows without also allowing another process
to "steal" the port.

SO_EXCLUSIVEADDRUSE doesn't come into it -- that is there to prevent
other processes stealing a port from the process that specified it, not
to prevent a process accidentally stealing another process' port.

Your patch to set SO_EXCLUSIVEADDRUSE is definitely not appropriate --
it will prevent restart of servers after they have crashed.

I would accept a patch that added a configuration parameter to
optionally disable the setting of SO_REUSEADDR, so the user can choose
which of the two problems they would prefer to have.

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan at grisby.org     --
   -- http://www.grisby.org --





More information about the omniORB-list mailing list