Skip to content

Conversation

@imerr
Copy link
Contributor

@imerr imerr commented Feb 13, 2023

Previously, if the DNS resolve returned an IPv6 address as the first entry it would use that Notable for connecting to "localhost" which resolves to ::1 (ipv6) first on windows

Previously, if the DNS resolve returned an IPv6 address as the first entry it would use that
Notable for connecting to "localhost" which resolves to ::1 (ipv6) first on windows
@miwarnec
Copy link
Collaborator

checking the KcpClient.Connect().
it uses the addresses[0].AddressFamily:
2023-02-20 - 12-59-03@2x

in theory, it should make connect work even if resolve gives ipv4 or ipv6.
what are we missing here?

@imerr
Copy link
Contributor Author

imerr commented Feb 20, 2023

Even though you connect to the right address family, the server might not be listening on that address family

For example the case of connecting to "localhost" with dual mode off
Start server, that listens to 127.0.0.1 only (not ::1)
Client resolves localhost to ["::1", "127.0.0.1"]
Attempts to connect to "::1" since that is the first address returned
Connection fails since there's no socket listening for ipv6, only ipv4

@miwarnec miwarnec force-pushed the master branch 3 times, most recently from d6ae9fe to eeb25ed Compare April 7, 2023 02:40
@miwarnec miwarnec force-pushed the master branch 2 times, most recently from ec826db to 5e2ef37 Compare October 28, 2023 18:42
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.

2 participants