Trying multiple addresses when opening socket.

Developer
Oct 1, 2012 at 1:52 PM

I've made some fixes for IPv6, and sorry for pushing a commit that introduce a new bug.

In the last commit, I fixed something I discovered, when using Dns.GetEntryHost() method, you can get a list of addresses from the returned IPEntryHost.

This list can contain IPv6 as well as IPv4 addresses. For example if you uses the "localhost" as server address, on a computer that support IPv6, the IPEntryHost address list, will contain: ::1 and 127.0.0.1, which are the IPv6 and IPv4 loopback addresses.

Imagine now you have an FTP server configured to listen only IPv4 addresses, when Dns.GetEntryHost() will retrieve the IPEntryHost the address list will contains IPv6 and IPv4 addresses (the localhost machine support IPv6), and since IPv6 will be the first, it will try to connect to it, by our server doesn't listen to it, and then cannot connect.

I was thinking if it is a good idea to try to connect the Socket with an address from the list, and if it can't connect try with the next one, until it works or totally fail ?

This is what FileZilla does (for example), it tries with the IPv6, fail and tries with the next address, IPv4 and then succeed.

Coordinator
Oct 1, 2012 at 1:58 PM
Not a problem with the bug, part of the development process. I think that what you're suggesting for looping through the returned address list is a good idea. Might also consider a public property that lets you disable the functionality for people with odd cases. We might also add an option that disables IPv6 all together, or rather, ignores IPv6 addresses in the list.

On Oct 1, 2012, at 8:52 AM, StrAbZ <notifications@codeplex.com> wrote:

From: StrAbZ

I've made some fixes for IPv6, and sorry for pushing a commit that introduce a new bug.

In the last commit, I fixed something I discovered, when using Dns.GetEntryHost() method, you can get a list of addresses from the returned IPEntryHost.

This list can contain IPv6 as well as IPv4 addresses. For example if you uses the "localhost" as server address, on a computer that support IPv6, the IPEntryHost address list, will contain: ::1 and 127.0.0.1, which are the IPv6 and IPv4 loopback addresses.

Imagine now you have an FTP server configured to listen only IPv4 addresses, when Dns.GetEntryHost() will retrieve the IPEntryHost the address list will contains IPv6 and IPv4 addresses (the localhost machine support IPv6), and since IPv6 will be the first, it will try to connect to it, by our server doesn't listen to it, and then cannot connect.

I was thinking if it is a good idea to try to connect the Socket with an address from the list, and if it can't connect try with the next one, until it works or totally fail ?

This is what FileZilla does (for example), it tries with the IPv6, fail and tries with the next address, IPv4 and then succeed.


Developer
Oct 1, 2012 at 2:04 PM

Ok :)

I'll check this, since I'm working on this stuffs right now.