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

System.Net.Sockets.UdpClient Hostname Resolution ignores DualMode flag #27477

Closed
nbaztec opened this issue Sep 26, 2018 · 0 comments
Closed

System.Net.Sockets.UdpClient Hostname Resolution ignores DualMode flag #27477

nbaztec opened this issue Sep 26, 2018 · 0 comments
Assignees
Milestone

Comments

@nbaztec
Copy link
Contributor

nbaztec commented Sep 26, 2018

Issue
For a UdpClient instance with underlying Socket having DualMode enabled, the socket does not work with hostnames that return IPv4 addresses.

Steps to reproduce

  • Set up a local hostname with IPv4 address - foobar.local
  • Create a UdpClient with AddressFamily.InterNetworkV6
  • Set sender.Client.DualMode = true, to enable IPv4 over IPv6
  • Send a datagram to a hostname sender.BeginSendAsync(new byte[1], 1, "foobar.local", 9000)
  • An exception is thrown that no valid IPv6 addresses could be found for foobar.local

Why it happens?
After the DNS resolution for the hostname is done, the addresses are directly matched against the socket's family(InterAddressV6 in our case), completely ignoring DualMode operation.

I'll submit a PR shortly

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 3.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants