localIp question...

M

Mobileboy36

Hi group,

I have a function to get the local ip from my pocket device using the
following code:

return
System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList(0).ToString

When the pocket is cradled I get the local ip: 192.168.8.240
That's OK

When the pocket is NOT cradled I get the loopback: 127.0.0.1 That's
OK

BUT: When I have got an active GPRS connection, I get something like
2002:51a9:647a::51a9:647a
Is this behaviour normal?

how can I convert it to a format x.x.x.x ??

best regards,
Mobile boy
 
N

Neil Cowburn

That looks somewhat like a IPv6 address. Some carriers use IPv6 addressing
for their GPRS network. You can check to which type of address it is by
looking at the AddressFamily property:

System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList(0).AddressFamily

--
Neil Cowburn
Principal Partner
OpenNETCF Consulting, LLC.

Managed Code in the Embedded World

http://www.opennetcf.com/
http://www.smartdeviceframework.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top