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

bind() for std::net::TcpStream #25102

Closed
tilpner opened this issue May 4, 2015 · 2 comments
Closed

bind() for std::net::TcpStream #25102

tilpner opened this issue May 4, 2015 · 2 comments

Comments

@tilpner
Copy link
Contributor

tilpner commented May 4, 2015

std::net::TcpStream doesn't expose an API to bind to local IP addresses.

Python solves this with an optional source_address argument.

mio seems to expose this with a bind method, and I think the standard library shouldn't omit such functionality.

@alexcrichton
Copy link
Member

Thanks for the report! This is currently covered by the std::net expansion RFC issue, though, so closing in favor of that.

@richardwhiuk
Copy link

For anyone in the future,, you can do this using the net2 crate - https://docs.rs/net2/0.2.32/net2/struct.TcpBuilder.html

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

No branches or pull requests

3 participants