views:

232

answers:

3

In .NET Compact Framework a device can have several IP Addresses I want to find one that is NOT coming from the Cellular connection. Goal is for WiFi or Ethernet connection.

Is there a way to do this?

Seems like State and Notification Broker would have a way to do this but didn't see a way.

+4  A: 

Nope, you'll have to do it manually.

Obviously there's not an easy way for you to know which IPs belong to cell or not. The easiest way would be to grab the "ISP" IP database from maxmind.com - http://www.maxmind.com/app/isp - which will give you the name of the ISP for any IP address (well, most IP addresses). You would then just setup a regular expression matching keywords like "sprint", "verizon wireless", "cellular", etc, to determine if it's a cell phone IP or not.

Not the prettiest of funnest solution but I'm not aware of a better way.

Sean
A: 

This is interesting question for searching the cellular IP address. Why not checking the cell phone's MAC address for any wireless geolocation? I think there is some HTML 5 API or wireless detection, right?

hexahow
A: 

Every operator has a group of IP addresses. If you know the network address of the operator you can compare the visitor's IP with operator's address.

So for example if you know the mobile operator owns a group of ip addresses starting with 212.235.*.*

you compare first 16 bits of the visitor's address with it, if for example the visitor's address is 212.235.190.215 you know it comes from mobile network.

You can check this condition with simple string operations - compare first x characters of visitor's ip address with x known characters at the beginning of operator's ip address.

niko