Thomas Munro <thomas.munro@gmail.com> writes:
> Interesting discovery. I think you might get the same behaviour from
> a Unix system if you set SO_LINGER to 0 before you exit[1]. I suppose
> if a TCP implementation is partially in user space (I have no idea if
> this is true for Windows, I never use it, but I recall that Winsock
> was at some point a DLL) and can't handle the existence of any socket
> state after the process is gone, you might want to nuke everything and
> tell the peer immediately that you're doing so on exit?
It's definitely plausible that Windows does this because it can't
handle retransmits once the sender's state is gone. However, it
seems to me that any such state would be tied to the open socket,
not to the sender process as such. Which would suggest that an
early close() as Lars suggests would make things worse not better.
This is all just speculation unfortunately. (Man, I hate dealing
with closed-source software.)
regards, tom lane