1

how to develop small app to windows ce ,to know network availability in device using c#

Renushi
  • 313
  • 9
  • 20
  • by network availability do you mean if something is actually connected to the internet, is it connected to a local network, is it connected to a vpn? This is a duplicate of http://stackoverflow.com/questions/520347/c-how-do-i-check-for-a-network-connection – msarchet Jan 20 '11 at 04:53
  • I've got the same problem, using Windows Mobile 6, I need to know if my device is connected to a network via Ethernet, Wireless, GPRS, VPN... I can't find a way to do this. Any ideas? Thanks –  Jan 24 '11 at 15:10

2 Answers2

1

( i am copying my answer to a similar question here )

Look in the registry key HKLM\system\state\connections, there is are entries for each of the possible network types, for instance:

When connected to a wireless network:

[HKLM\system\state\Connections\Network]
Adapters="BCMSDDHD1"
Count=dword:00000001
Descriptions="Business World"

when connected to activesync:

[HKLM\system\state\Connections\Desktop]
Adapters=""
Count=dword:00000001
Descriptions="CurrentDTPTNetwork"

The Count value under HKLM\system\state\connections gives you the total number of active connections.

In HKLM\system\state\Hardware you can find the current power state of the various devices.

Community
  • 1
  • 1
Willem Hengeveld
  • 2,758
  • 23
  • 19
0

Use HttpWebRequest, and try connecting to Google:

http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest(v=VS.80).aspx

MusiGenesis
  • 74,184
  • 40
  • 190
  • 334