Skip to content

gh-111112: Avoid potential confusion in TCP server example. #111113

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

Merged
merged 1 commit into from
Feb 1, 2024

Conversation

aidanholm
Copy link
Contributor

@aidanholm aidanholm commented Oct 20, 2023

socket.recv(), as documented by the Python reference documentation, returns at most bufsize bytes, and the underlying TCP protocol means there is no guaranteed correspondence between what is sent by the client and what is received by the server.

This conflation could mislead readers into thinking that TCP is datagram-based or has similar semantics, which will likely appear to work for simple cases, but introduce difficult to reproduce bugs.


📚 Documentation preview 📚: https://cpython-previews--111113.org.readthedocs.build/

@ghost
Copy link

ghost commented Oct 20, 2023

All commit authors signed the Contributor License Agreement.
CLA signed

socket.recv(), as documented by the Python reference documentation,
returns at most `bufsize` bytes, and the underlying TCP protocol means
there is no guaranteed correspondence between what is sent by the client
and what is received by the server.

This conflation could mislead readers into thinking that TCP is
datagram-based or has similar semantics, which will likely appear to
work for simple cases, but introduce difficult to reproduce bugs.
Copy link
Contributor

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@hauntsaninja hauntsaninja merged commit a79a272 into python:main Feb 1, 2024
@miss-islington-app
Copy link

Thanks @aidanholm for the PR, and @hauntsaninja for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 1, 2024
…thonGH-111113)

Improve misleading TCP server docs and example.

socket.recv(), as documented by the Python reference documentation,
returns at most `bufsize` bytes, and the underlying TCP protocol means
there is no guaranteed correspondence between what is sent by the client
and what is received by the server.

This conflation could mislead readers into thinking that TCP is
datagram-based or has similar semantics, which will likely appear to
work for simple cases, but introduce difficult to reproduce bugs.
(cherry picked from commit a79a272)

Co-authored-by: Aidan Holm <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 1, 2024
…thonGH-111113)

Improve misleading TCP server docs and example.

socket.recv(), as documented by the Python reference documentation,
returns at most `bufsize` bytes, and the underlying TCP protocol means
there is no guaranteed correspondence between what is sent by the client
and what is received by the server.

This conflation could mislead readers into thinking that TCP is
datagram-based or has similar semantics, which will likely appear to
work for simple cases, but introduce difficult to reproduce bugs.
(cherry picked from commit a79a272)

Co-authored-by: Aidan Holm <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Feb 1, 2024

GH-114831 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Feb 1, 2024
@bedevere-app
Copy link

bedevere-app bot commented Feb 1, 2024

GH-114832 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Feb 1, 2024
hauntsaninja pushed a commit that referenced this pull request Feb 1, 2024
…H-111113) (#114831)

gh-111112: Avoid potential confusion in TCP server example. (GH-111113)

Improve misleading TCP server docs and example.

socket.recv(), as documented by the Python reference documentation,
returns at most `bufsize` bytes, and the underlying TCP protocol means
there is no guaranteed correspondence between what is sent by the client
and what is received by the server.

This conflation could mislead readers into thinking that TCP is
datagram-based or has similar semantics, which will likely appear to
work for simple cases, but introduce difficult to reproduce bugs.
(cherry picked from commit a79a272)

Co-authored-by: Aidan Holm <[email protected]>
hauntsaninja pushed a commit that referenced this pull request Feb 1, 2024
…H-111113) (#114832)

gh-111112: Avoid potential confusion in TCP server example. (GH-111113)

Improve misleading TCP server docs and example.

socket.recv(), as documented by the Python reference documentation,
returns at most `bufsize` bytes, and the underlying TCP protocol means
there is no guaranteed correspondence between what is sent by the client
and what is received by the server.

This conflation could mislead readers into thinking that TCP is
datagram-based or has similar semantics, which will likely appear to
work for simple cases, but introduce difficult to reproduce bugs.
(cherry picked from commit a79a272)

Co-authored-by: Aidan Holm <[email protected]>
@aidanholm aidanholm deleted the patch-1 branch February 4, 2024 04:52
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
…thon#111113)

Improve misleading TCP server docs and example.

socket.recv(), as documented by the Python reference documentation,
returns at most `bufsize` bytes, and the underlying TCP protocol means
there is no guaranteed correspondence between what is sent by the client
and what is received by the server.

This conflation could mislead readers into thinking that TCP is
datagram-based or has similar semantics, which will likely appear to
work for simple cases, but introduce difficult to reproduce bugs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants