Re: socket.unbind or socket.unlisten? - socket.error: (48, 'Addressalready in use')
Laszlo Nagy wrote:
>>> ....... Setting the
>>> SO_REUSEADDR flag on POSIX fixes this problem (don't set it on Windows,
>> Why not? I have been merrily setting it, and I have not noticed
>> anything weird.
> Please see my original post. I specifically stated that I do not want to
> use setsockopt and be able to listen on the same port from many
> processes. I knew that I could use SO_REUSEADDR, but I'm heistating to
> do so. I must guarantee that only one process listens on a given port at
> the same time.
My previous reply assumed you are running some UNIX-like operating
system. If you are on Windows then Jean-Paul's advice stands, as Windows
*does* allow several processes to listen on the same port and randomly
delivers incoming connections to one of the listening processes.
I believe this is because Microsoft failed to understand the original
meaning of SO_REUSEADDR for their early TCP implementations, and
persisted with this ghastly error in the name of backwards
compatibility, justifying it by suggesting that listener pools could be
created. Or some such nonsense. Perhaps someone with more insight into
the development process could comment. It seems to me it's completely
In article <(E-Mail Removed) t>,
Grant Edwards <(E-Mail Removed)> wrote:
>On 2009-02-01, Steve Holden <(E-Mail Removed)> wrote:
>> I believe this is because Microsoft failed to understand the
>> original meaning of ___________________, and persisted with
>> this ghastly error in the name of backwards compatibility,
>> justifying it by suggesting that _________________________.
>Somebody should have cards printed up...