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 hint SDL_NET_HINT_IP_DEFAULT_VERSION to select IPv6 or IPv4 #120

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mkunkacnc
Copy link

@mkunkacnc mkunkacnc commented Feb 15, 2025

I am on Windows 10, building SDL3_net with winlibs gcc 14.2.0, upgrading my code from SDL2_net to SDL3_net.

As mentioned in pull request #85, When creating a socket bound to a NULL address, the default used in MakeAddrInfoWithPort is AF_UNSPEC. This is causing a problem in my mixed IPv4/IPv6 environment. A hint will allow the user to specify what they want to use.

Also using this hint in ResolveAddress will resolve the ip addresses in a consistent manner. All ipv4 or all ipv6, with ipv4 mapped to ipv6 as needed.

Pull request #85 by itself doesn't fix my problem.

Without these changes, I get the following error when trying to send data over a UDP socket from computer mdk0 to mdk1. (Both computers are Windows 10.)

image

The error is created by the call to sendto in SendOneDatagram.

If I use "IPv4" as the value for the hint, everything works correctly. If I use "IPv6" as the value, it also works correctly.

When creating a socket bound to a NULL address, the default is AF_UNSPEC. This is causing a problem in my mixed IPv4/IPv6 environment (Window 10).  A hint will allow the user to specify what they want to use.
So that the ip addresses will be in a consistent version.
@sezero sezero requested a review from icculus February 15, 2025 21:12
@mkunkacnc
Copy link
Author

This pull request could be used to resolve issue #115

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

Successfully merging this pull request may close these issues.

1 participant