Can anybody help that issue ?
Why are you connecting by IP address instead of by name? Have you tried connecting by name and, if so, what was the result?
Ip or Domain same Rejected
Did they state the reason was IPv6 or is that an assumption? Are you sure they are able to reach your server at all?
they connected over ipv4 very well. but ipv6 lost..
When you lookup a host by name, if you're on an ipv4 connection, you'll only get ipv4 addresses. If you're on an ipv6 connection, then you'll get back ipv4 addresses as well as ipv6 addresses. If the target host is ipv4-only and you're on ipv6, you'll get back a synthesized ipv6 address.
You need to determine if you're on an ipv6-capable connection and act accordingly. Something like:
string GetIPAddress(string target)
IPHostEntry host = Dns.GetHostEntry(target);
String ips = "";
foreach (IPAddress addr in host.AddressList)
if (addr.AddressFamily == AddressFamily.InterNetworkV6)
return addr.ToString(); // we're on ipv6 so use that
else if (addr.AddressFamily == AddressFamily.InterNetwork)
ips = addr.ToString(); // store the ipv4 version in case we don't find an ipv6 entry
return ips; // we didn't find an ipv6 entry, so return the stored ipv4 version
The returned string can be used as is, regardless of network type. It will be ipv6 (possibly synthesized) if you're on ipv6, and ipv4 if you're on ipv4.
Note that target is the hostname you're trying to connect to, not an IP address.
Also, note this was typed in without benefit of testing, so you're mileage may vary and you may need some usings and/or namespace prefixes.
I have the same problem, but my call to the rest API is done in the PCL, so I have no access to IPAdress namespace... How can I do to convert my IP Adress?
@Emilien - Don't use an IP address if you can avoid it. Use a hostname instead. Unless you're using lower-level API's, you shouldn't have to change anything as long as you connect with a hostname and don't do any address lookup on your own.
Unfortunately I have no hostname...
And I have to publish my application very soon..
Then you'll need to implement the IPAddress code in platform-specific code and access it from the PCL using dependency injection.
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies