I am using some code that gets the IP address of the iPhone so it can set up
a httplistener. This worked ok until one of the devices was upgraded to
iOS6. The code looked like this:


string hostName = System.Net.Dns.GetHostName () + ".local";
IPHostEntry hostEntry = Dns.GetHostEntry (hostName);
IPAddress localAddr = hostEntry.AddressList[0];

In iOS5 it was necessary to add the .local to the hostname in order for
GetHostEntry() to work properly. This would give an address on the same
subnet and a windows prorgam was able to communicate with the httplistener. 

In iOS6 I have to remove the +".local" part otherwise I get an error "No
such host is known".

When I remove it, the code works but I actually get an IP address of
199.101.28.130 which is on a separate subnet. As a result my Windows app
running on 192.168.0.2 cannot communicate with it.

What happened? :-(



--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Issue-with-getting-an-IP-address-unde-iOS6-tp4657173.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to