Doing socket things with C++ this article helped me a few times
"The ultimate SO_LINGER page" - an old article about weird problems when you close TCP connections
Submitted 1 year ago by vegeta@lemmy.dbzer0.com to programming@programming.dev
beejjorgensen@lemmy.sdf.org 1 year ago
So the page says:
But Stevens says:
And, referring to the default
close
behavior:Also:
I’m having trouble reconciling this with the article’s position that data will be discarded by the sender OS with a plain non-
SO_LINGER
close()
.I can see how the sender might be blissfully unaware that the receiver program might have crashed after the data had been sent and the connection had been closed, but before the data had arrived at the receiver program. And that’s where some kind of application ACKing mechanism might be in order.
I can also see that the receiver OS might happily collect the data and shutdown the socket correctly and then the sender app thinks everything is fine, but the receiver app has crashed and will never see the data.
But neither of those conditions result in the receiver app in the example showing less than 1,000,000 bytes received unless there’s an error.
What am I missing?
vegeta@lemmy.dbzer0.com 1 year ago
I confess the subject gets me confused, but my guesses are that you either are using newer information (that article is pretty old), or that you’re using information that doesn’t apply to all OSs.
I certainly had this problem happening before, the software was multi-platform, but I think it was observed on windows