Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One of the common operations used in TCP programming is shutting down parts of the full-duplex connection [1] [2]. In c3ws [3] we are employing the technique described in [4] on closing the connection to ensure more reliable delivery of data which relies on the shutdown operation. But since c3ws is supposed to work with different variety of sockets (blocking, non-blocking, encrypted, etc, etc) via an abstract interface to separate concerns, it would be nice if the shutdown operation was part of the cross-platform Socket interface.
This PR tries to introduce such operation for POSIX and WIN32 environment. I haven't tested it on WIN32 though, but it should be almost the same as on POSIX.
References:
[1] shutdown function (winsock.h)
[2] shutdown(2) — Linux manual page
[3] c3ws - WebSocket library in C3
[4] The ultimate SO_LINGER page, or: why is my tcp not reliable