Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-128319: Add missing server class attributes to socketserver docs#128320
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
gh-128319: Add missing server class attributes to socketserver docs#128320
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks for doing this :)
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
reactive-firewall left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
👍🏻 LGTM! With conditions (see knit-picky inline comment)
🙇 Thanks@stephen-hansen; These document drafts have already been useful to me.
The maximum amount of data (in bytes) to receive at once. If a packet is | ||
too large for the buffer, then the excess bytes beyond :attr:`max_packet_size` | ||
are discarded. The default value is usually ``8192``, but this can be | ||
overridden by subclasses. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM! With conditions:
Please consider clarifying if the term "data" here, means without IP/UDP headers with something like:
The maximum amount of data (in bytes) to receive at once. If a packet is | |
too large for the buffer, then the excess bytes beyond:attr:`max_packet_size` | |
are discarded. The default value is usually ``8192``, but this can be | |
overridden by subclasses. | |
The maximum amount of data (in bytes) to receive at once. If a packet's | |
payload (excluding headers) istoo large for the buffer, then the excess | |
bytes beyond:attr:`max_packet_size`are discarded. The default value | |
is usually ``8192``, but this can beoverridden by subclasses. |
or if this really is the literal maximum packet size:
The maximum amount of data (in bytes) to receive at once. If a packet is | |
too large for the buffer, then the excess bytes beyond:attr:`max_packet_size` | |
are discarded. The default value is usually ``8192``, but this can be | |
overridden by subclasses. | |
The maximum amount of data (in bytes) to receive at once. If a packet's | |
payload (including headers) istoo large for the buffer, then the excess | |
bytes beyond:attr:`max_packet_size`are discarded. The default value | |
is usually ``8192``, but this can beoverridden by subclasses. |
Rational:
Omission of any mention of header when talking about a "packet" being "too large" is somewhat misleading to the reader.
not sure if going further is relevant to the python side, but for convenience sake I'll mention, the typical 20-byte IPV4 header (RFC-791 gives 20-byte base header, 40-byte maximum options) and the required 8-byte header assuming UDP (RFC-768).
Hopefully this helps.
Additional considerations (TL;DR):
- MTU, and fragmentation boundaries are possible reasons to want to change the default (eg. expected max burst count * max packet size (including headers) on network path with values of
5 * (1500 - 20 - 40 - 8)
=7160
so the default is somewhat larger than the similar stream sockets'request_queue_size
default) - UDP max packet size (after headers) is a possible (albeit unlikely) reason for increasing the size well beyond the default of
8192
Uh oh!
There was an error while loading.Please reload this page.
Just doing some cleanup of the socketserver docs regarding class attributes as mentioned in the linked issue.
address_family
attribute from instance attributes to class attributes.allow_reuse_port
.max_packet_size
(note UDP only).request_queue_size
to denote TCP only.📚 Documentation preview 📚:https://cpython-previews--128320.org.readthedocs.build/