* David Schwartz wrote on Sun, Aug 23, 2009 at 15:40 -0700:
> > My question is why _using the same code_ Windows is returning
> > WSAEWOULDBLOCK instead of WSAECONNREFUSED when my server is down?
> > while UNIX correctly returns ECONNREFUSED...
>
> Because Windows cannot tell whether your server is down or
> [...]
Nice summary and explanation, thank you.
> Because Windows servers do not behave correctly,
I think this suggests that replying a connect request with `tcp
connection refused' would be wrong TCP server behavior, but as I
understand, it is correct what Windows is doing:
man listen(2)
int listen(int s, int backlog);
[...]
The backlog parameter defines the maximum length the queue
of pending connections may grow to. If a connection
request arrives with the queue full the client may receive
an error with an indication of ECONNREFUSED or, if the
underlying protocol supports retransmission, the request
may be ignored so that retries succeed.
So unfortunately portable code cannot detect whether remote side
has no listener (i.e. cannot detect whether the error is
permanent or temporary). Personally I think this is itself is
correct, because of course noone can tell that ever for sure (as
David's server restart example shows), but customers keep
requesting it and often code relies on that and behaves strangely.
Steffen
End of message.
--
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]