Add hint SDL_NET_HINT_IP_DEFAULT_VERSION to select IPv6 or IPv4 #120
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.)
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.