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

Support ephemeral port assignments on bind #110

Merged
merged 6 commits into from
Mar 30, 2023
Merged

Conversation

th7nder
Copy link
Contributor

@th7nder th7nder commented Mar 21, 2023

Copy link
Contributor

@mcches mcches left a 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!

Comment on lines 27 to 29
///
/// Only 0.0.0.0 is currently supported.
/// When the port is unspecified (0), an ephemeral port number is generated.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
///
/// Only 0.0.0.0 is currently supported.
/// When the port is unspecified (0), an ephemeral port number is generated.
/// Binding with a port number of 0 will request that the OS assigns a port
/// to this listener. The port allocated can be queried via the `local_addr`
/// method.
///
/// Only 0.0.0.0 is currently supported.

src/net/udp.rs Outdated
@@ -94,6 +94,7 @@ impl UdpSocket {
/// provided.
///
/// Only 0.0.0.0 is currently supported.
/// When the port is unspecified (0), an ephemeral port number is generated.
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's update this one to public docs as well:

/// This function will create a new UDP socket and attempt to bind it to
/// the `addr` provided.
///
/// Binding with a port number of 0 will request that the OS assigns a port
/// to this listener. The port allocated can be queried via the `local_addr`
/// method.

src/net/udp.rs Show resolved Hide resolved
src/net/tcp/listener.rs Outdated Show resolved Hide resolved
src/net/udp.rs Outdated Show resolved Hide resolved
@mcches mcches linked an issue Mar 30, 2023 that may be closed by this pull request
@mcches mcches merged commit 52ed4f7 into tokio-rs:main Mar 30, 2023
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.

support ephemeral port assignments
2 participants