2009-02-19

More socket strangeness

Today's fun fact:

If you're on Windows XP, and you have a TCP socket, and you have set SO_SNDBUF to 0 in order to do your own sender buffering, and you have called WSASend to start an overlapped send operation and Windows has called your callback stating the the send succeeded, and the other end of the socket is on the same machine, and that other end has not yet read the data you wrote, and you then call shutdown() to close the sending end of the socket, then the connection will be reset!

It works fine if you never touch SO_SNDBUF at all. But it doesn't help to set SO_SNDBUF to a nonzero value only just before shutdown()...

No comments:

Post a Comment