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

multicast example panic (Mac) #70

Closed
dabat opened this issue Apr 9, 2021 · 5 comments
Closed

multicast example panic (Mac) #70

dabat opened this issue Apr 9, 2021 · 5 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@dabat
Copy link

dabat commented Apr 9, 2021

hi @lemunozm ! excellent work on this crate, very exciting!

just wanted to share that while i was reviewing and running some of the examples, i found this issue where the second client to attempt running the multicast example panics after connecting, with an Address already in use error.

image

@lemunozm
Copy link
Owner

lemunozm commented Apr 9, 2021

Hi @dabat, thanks for the comment, I'm glad you like it 😃

It's really weird since on my computer this is working and this functionality is the base of termchat and anybody complains about it...

I checked the code and the reuse address is set to true correctly in multicast to avoid these issues.

Could you tell me the OS version are you using? Thanks!

@lemunozm
Copy link
Owner

Hi, what's the state of this issue? Did it work?

@dabat
Copy link
Author

dabat commented Jun 4, 2021

hi @lemunozm my apologies for not getting back to you, the emails were buried in my inbox.
i am still seeing this error in the multicast example.
image

i'm running on macOS 11.4 and i pulled latest on master branch.
as you can see in the error message,
thread 'main' panicked at 'called Result::unwrap()on anErr value: Os { code: 48, kind: AddrInUse, message: "Address already in use" }', examples/multicast/main.rs:23:70
this is the line that is panicing

handler.network().listen(Transport::Udp, multicast_addr).unwrap();

@lemunozm
Copy link
Owner

lemunozm commented Jun 7, 2021

Hi @dabat , thanks so much for your answer.

I made a integration test to run this use-case in CI: #94

As you noticed, multicast is not working in newer versions of Mac. Mac requires to add also the SO_REUSEPORT option in addition to SO_REUSEADDR.

Two interesting resources about it:

Solution overview:

net2 (used currently to enable SO_REUSEADDR) do not support SO_REUSE_PORT. Use socket2 instead that support it

@lemunozm lemunozm added bug Something isn't working good first issue Good for newcomers labels Jun 7, 2021
@lemunozm lemunozm changed the title multicast example panic multicast example panic (Mac) Jun 7, 2021
@lemunozm
Copy link
Owner

Fixed in version 0.14.2

Since the test is already working in Mac I close the issue. If you continue having problems, feel free to reopen it.

Thanks for notifying the error!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants