Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Socket.shutdown() #1929

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

rexim
Copy link
Contributor

@rexim rexim commented Feb 6, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant