-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
socketserver's TCPServer documentation only presents case of single request per connection #112020
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
Labels
docs
Documentation in the Doc dir
Comments
This was referenced Nov 14, 2023
serhiy-storchaka
pushed a commit
that referenced
this issue
Feb 20, 2024
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Feb 20, 2024
…et.recv() (pythonGH-112055) (cherry picked from commit e71468b) Co-authored-by: talcs <[email protected]>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Feb 20, 2024
…et.recv() (pythonGH-112055) (cherry picked from commit e71468b) Co-authored-by: talcs <[email protected]>
serhiy-storchaka
pushed a commit
that referenced
this issue
Feb 20, 2024
…ket.recv() (GH-112055) (GH-115723) (cherry picked from commit e71468b) Co-authored-by: talcs <[email protected]>
serhiy-storchaka
pushed a commit
that referenced
this issue
Feb 20, 2024
…ket.recv() (GH-112055) (GH-115722) (cherry picked from commit e71468b) Co-authored-by: talcs <[email protected]>
woodruffw
pushed a commit
to woodruffw-forks/cpython
that referenced
this issue
Mar 4, 2024
@talcs wow thank you so much for this, it just led to a fix for a longstanding and intermittent bug I had 🙏🏻 🙏🏻 🙏🏻 Super lucky I just happened to be skimming socket docs for an unrelated project and noticed it 😂 |
diegorusso
pushed a commit
to diegorusso/cpython
that referenced
this issue
Apr 17, 2024
LukasWoodtli
pushed a commit
to LukasWoodtli/cpython
that referenced
this issue
Jan 22, 2025
gpshead
added a commit
to gpshead/cpython
that referenced
this issue
Feb 6, 2025
Outdated code updated, the BaseRequestHandler example is now much more illustrative instead of the bad idea of a single recv() call for TCP. tested, they now work.
gpshead
added a commit
that referenced
this issue
Feb 6, 2025
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Feb 6, 2025
…-129741) pythongh-112020: Rework socketserver examples to be correct. Outdated code updated, the BaseRequestHandler example is now much more illustrative instead of the bad idea of a single recv() call for TCP. tested, they now work. (cherry picked from commit 78377c7) Co-authored-by: Gregory P. Smith <[email protected]>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Feb 6, 2025
…-129741) pythongh-112020: Rework socketserver examples to be correct. Outdated code updated, the BaseRequestHandler example is now much more illustrative instead of the bad idea of a single recv() call for TCP. tested, they now work. (cherry picked from commit 78377c7) Co-authored-by: Gregory P. Smith <[email protected]>
gpshead
added a commit
that referenced
this issue
Feb 6, 2025
…) (#129743) gh-112020: Rework socketserver examples to be correct. Outdated code updated, the BaseRequestHandler example is now much more illustrative instead of the bad idea of a single recv() call for TCP. tested, they now work. (cherry picked from commit 78377c7) Co-authored-by: Gregory P. Smith <[email protected]>
gpshead
added a commit
that referenced
this issue
Feb 6, 2025
…) (#129744) gh-112020: Rework socketserver examples to be correct. Outdated code updated, the BaseRequestHandler example is now much more illustrative instead of the bad idea of a single recv() call for TCP. tested, they now work. (cherry picked from commit 78377c7) Co-authored-by: Gregory P. Smith <[email protected]>
srinivasreddy
pushed a commit
to srinivasreddy/cpython
that referenced
this issue
Feb 7, 2025
…29741) pythongh-112020: Rework socketserver examples to be correct. Outdated code updated, the BaseRequestHandler example is now much more illustrative instead of the bad idea of a single recv() call for TCP. tested, they now work.
cmaloney
pushed a commit
to cmaloney/cpython
that referenced
this issue
Feb 8, 2025
…29741) pythongh-112020: Rework socketserver examples to be correct. Outdated code updated, the BaseRequestHandler example is now much more illustrative instead of the bad idea of a single recv() call for TCP. tested, they now work.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Documentation
The TCPServer examples here suggest that the
BaseRequestHandler.handle
method should callself.request.recv
just once, and return, which closes the socket immediately, forcing the client to create a new socket and reconnect for every single request.I think there should be at least one example where the
handle
method keeps running until the client hangs, which can be indicated whenrecv
's returned value has a length of 0, which by the way, should be covered in the socket.recv documentation. The meaning of 0 as a returned value ofsocket.recv
is covered in the C API docs.Sample code that allows multiple requests using the same connection can be seen here.
Linked PRs
The text was updated successfully, but these errors were encountered: