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

Add TcpSocket methods to set reuseport and reuseaddr to UdpSocket #5485

Open
reconbot opened this issue Feb 20, 2023 · 5 comments
Open

Add TcpSocket methods to set reuseport and reuseaddr to UdpSocket #5485

reconbot opened this issue Feb 20, 2023 · 5 comments
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request. M-net Module: tokio/net

Comments

@reconbot
Copy link

Is your feature request related to a problem? Please describe.
I'm working on porting an existing udp multicast based application to rust and I need to to be able to have multiple versions of the program reading from the same port in a multicast session. (Made possible by reuseaddr with udp and multicast)

Describe the solution you'd like
These methods exist for TcpSocket and I'd like to see them on UdpSocket

Describe alternatives you've considered
I hear its possible to bind a socket and give it to tokio. I have found some comments in the source and some github issues to this effect but I haven't found documentation.

Additional context

@reconbot reconbot added A-tokio Area: The main tokio crate C-feature-request Category: A feature request. labels Feb 20, 2023
@Darksonn Darksonn added the M-net Module: tokio/net label Feb 20, 2023
@Noah-Kennedy
Copy link
Contributor

The preferred way to do this is to use socket2

@reconbot
Copy link
Author

Why have it inconsistent though?

@Darksonn
Copy link
Contributor

If we expose them for TcpSocket, then I guess it's fine to also do so for UdpSocket.

@Noah-Kennedy
Copy link
Contributor

I agree, it's just a matter of finding a way to make the semantics work well here. Do these need to be enabled before binding? I can't recall.

@reconbot
Copy link
Author

Osx needs it before. I recall the answer for linux is "it depends".

I can see why we'd suggest using socket2 as it's not possible to do that with the bind api.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request. M-net Module: tokio/net
Projects
None yet
Development

No branches or pull requests

3 participants