Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
net: documentation for SetLinger() is misleading #7979
The documentation for tcp.SetLinger() says; If sec < 0 (the default), Close returns immediately and the operating system finishes sending the data in the background. This seems to make a promise which is rarely true. Indeed, it seems that the expectation is that if the operating system supports this it works, but the operating systems I've seen don't do this. Instead, the Close() behavior seems to be that the operating system may discard unset data. And indeed that's what I've seen. I recommend the wording be changed to say: If sec < 0; Close returns immediately. The operating system may attempt to continue to send data in the background, or the unset or unacknowledged data may be discarded.