-
Notifications
You must be signed in to change notification settings - Fork 284
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
Get a Random Unused TCP/IP or UDP Port #123
Labels
Comments
I'll give it a stab. Do you think std::net::TcpListener would suffice or should this be Tokio? |
I would stick with the standard library if possible. Though I have no idea how to implement this 😅 my first step would be rummaging through docs. |
let socket = UdpSocket::bind("127.0.0.1:0").unwrap(); |
use std::net::TcpListener;
let listener = TcpListener::bind("127.0.0.1:0").unwrap(); 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 TcpListener::local_addr method. |
facebook-github-bot
pushed a commit
to facebook/buck2
that referenced
this issue
Jul 27, 2022
Summary: Pass tcp port using `--tcp-port` param from buck2 to buck1's installer binary instead of hardcoding it. Port is generated using `Binding with a port number of 0 will request that the OS assigns a port to this listener.` : rust-lang-nursery/rust-cookbook#123 (comment) Reviewed By: krallin Differential Revision: D38063436 fbshipit-source-id: f74e1fa076ac49b4c0faa1d5141a70594d059541
facebook-github-bot
pushed a commit
to facebook/buck
that referenced
this issue
Jul 27, 2022
Summary: Pass tcp port using `--tcp-port` param from buck2 to buck1's installer binary instead of hardcoding it. Port is generated using `Binding with a port number of 0 will request that the OS assigns a port to this listener.` : rust-lang-nursery/rust-cookbook#123 (comment) Reviewed By: krallin fbshipit-source-id: f74e1fa076ac49b4c0faa1d5141a70594d059541
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: