Log in

View Full Version : Are You Connected?


Andy Sjostrom
08-05-2004, 11:05 AM
<div class='os_post_top_link'><a href='http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/networkcomponent.asp' target='_blank'>http://msdn.microsoft.com/library/d...rkcomponent.asp</a><br /><br /></div>Designing applications that are automatically aware of whether or not a network connection exists becomes increasingly interesting. Today's devices can connect using cellular networks, WiFi networks and even passing through the connection held by a desktop PC. Synchronization is one scenario where an application's ability to make intelligent and automatic decisions based on connectivity is useful.<br /><br />MSDN authors Dan Fox and Jon Box just got their latest contribution "Testing for and Responding to Network Connections in the .NET Compact Framework" published. Take a look at their sample code to learn how to detect network connections from your Microsoft® .NET Compact Framework-based applications.

ctitanic
08-05-2004, 01:37 PM
I wonder if instead of using 127.0.0.1 you use the IP of a well known web site, is that going to tell you if you are connectted to Internet?

I guess I'll have to test it by myself :D

Another trick could be to use the AS IP and that should tell you if you are connected via AS :?:

Andy Sjostrom
08-05-2004, 01:43 PM
I wonder if instead of using 127.0.0.1 you use the IP of a well known web site, is that going to tell you if you are connectted to Internet?

I guess I'll have to test it by myself :D

Another trick could be to use the AS IP and that should tell you if you are connected via AS :?:

This is what we did here: http://www.businessanyplace.net/?p=code#checkconnect 8)

Andy Sjostrom

ctitanic
08-05-2004, 01:55 PM
Thanks! Let me translate your code to VB .NET :D

manywhere
08-05-2004, 01:55 PM
Thanks for both links! :D They will come in handy really soon! ;)

jimlad
08-05-2004, 03:02 PM
Yes, having a lot of experience of this problem it is much better to check by doing a PING to a local address or gateway etc. The technique used in the article requires the device's TCP/IP and DHCP implementations to be reliable, which of course, is not always the case. If they'd tried this approach on some of the early iPAQ 5450's (pre-SP) then it almost certainly would have been less reliable than a PING.

sub_tex
08-05-2004, 03:25 PM
This is what we did here: http://www.businessanyplace.net/?p=code#checkconnect 8)

I've just recently started picking up C# and have been interested in PPC development. Thanks for the link!

I'm still upset at how boring the UI elements on PPC are, though. Ugly ugly ugly! They remind me of Windows 3.1

Those standard ugly gray buttons. . . I was hoping MS would try and add some visually appealing controls with the new OS. :(

ctitanic
08-05-2004, 03:41 PM
Using OpenNETCF you can change the MS controls for other more appealing.

www.opennetcf.org