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

Allow UDP broadcasts #97

Open
captain0xff opened this issue May 3, 2024 · 4 comments
Open

Allow UDP broadcasts #97

captain0xff opened this issue May 3, 2024 · 4 comments

Comments

@captain0xff
Copy link
Contributor

captain0xff commented May 3, 2024

SDL2_net had a way to enable or disable UDP broadcasts

#ifdef SO_BROADCAST
it will be nice to also have them in SDL3_net.

@icculus
Copy link
Collaborator

icculus commented May 3, 2024

So the problem is broadcasts are an IPv4 subnet thing. This concept is entirely gone from IPv6, where they have something called "anycast" addresses, but it requires configuring entire groups of computers to use it...it's not like IPv4 where you just send a packet to the .255 address and things that care listen for it.

@captain0xff
Copy link
Contributor Author

Oh, I was not aware of this. Ig I will have to find a better solution for server discovery. Anyways, thank you for answering. You can close the issue if you want.

@icculus
Copy link
Collaborator

icculus commented May 5, 2024

So Wikipedia has this to say:

Internet Protocol version 6 (IPv6) does not implement this method of broadcast, and therefore does not define broadcast addresses. Instead, IPv6 uses multicast addressing to the all-hosts multicast group. No IPv6 protocols are defined to use the all-hosts address, though; instead, they send and receive on particular link-local multicast addresses. This results in higher efficiency because network hosts can filter traffic based on multicast address and do not need to process all broadcasts or all-hosts multicasts.

...so maybe this is doable? I'll leave this open for now until I research more.

@captain0xff
Copy link
Contributor Author

Found an multicast example that seems to work for me.
https://gist.github.com/hostilefork/f7cae3dc33e7416f2dd25a402857b6c6

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

2 participants