On Sat, Aug 13, 2005 at 03:54:41PM -0500, Micah Anderson <[EMAIL PROTECTED]> 
wrote:
> I am not aware of how this would be done,
> could you provide a patch that

no, because I am not python-savvy, but in C you would simply do this:

   int fd = socket (...)

   int oval = 1;
   setsockopt (fd, SOL_SOCKET, SO_REUSEADDR, &oval, sizeof oval);

   bind, listen... etc.

on the listening socket and forget about it. The python interface should
be _similar_ but not identical, I guess.

It's documented e.g. in socket(7) and ip(7):

       SO_REUSEADDR
              Indicates that the rules used in validating addresses
              supplied in a bind(2) call should allow reuse of local
              addresses.  For PF_INET sockets this means that a socket
              may bind, except when there is an active listening socket
              bound to the address. When the listening socket is bound to
              INADDR_ANY with a specific port then it is not possible to
              bind to this port for any local address.

     ---

              A TCP local socket address that has been bound is
              unavailable for some time after closing, unless the
              SO_REUSEADDR flag has been set.  Care should be taken when
              using this flag as it makes TCP less reliable.


-- 
                The choice of a
      -----==-     _GNU_
      ----==-- _       generation     Marc Lehmann
      ---==---(_)__  __ ____  __      [EMAIL PROTECTED]
      --==---/ / _ \/ // /\ \/ /      http://schmorp.de/
      -=====/_/_//_/\_,_/ /_/\_\      XX11-RIPE


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to