On 3/7/07, Joshua J. Kugler <[EMAIL PROTECTED]> wrote:
> Greg Copeland wrote:
> >> Is there some history to this of which I'm not aware?  Is there a good
> >> reason for it to default to false?
> <SNIP Greg's very informative reply>
> > Long story short, it is not a bug.  It is a feature.  The proper
> > default is that of the OS, which is to ensure SO_REUSEADDR is disabled
> > unless you absoluetely understand what you're buying by enabling it.
>
> Thanks for your reply.  Those are all point of which I had not been aware.
>
> My problem (and the reason I set reuse to True) is this: if I have
> connections active when I restart my service, upon restart, the socket will
> fail to bind because there is still a connection in a WAIT state.  And
> until that old connection goes away (30 seconds or so?) I cannot restart
> the service.  So, the only option would be to sit there in a loop calling
> serve_forever until it doesn't throw a "can't bind to socket" exception.
>
> Or is there something I'm *really* missing about the way SocketServer is
> supposed to work?  Am I supposed to notify my connection threads to shut
> down and disconnect "properly?"  Which gets even more fun since they are
> sitting there waiting for input on the connection and not in a position to
> respond to other events...gets back to the fun of "killing" threads that
> are blocking.
>
> j
>

This is just the way sockets work on your platform. How exactly
sockets shut down, and the exact effect that SO_REUSEADDR varies from
platform to platform. In your case, using it is probably reasonable.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to