Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Compact Framework / January 2006

Tip: Looking for answers? Try searching our database.

Network detection in CF 2.0?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeppe Jespersen - 10 Jan 2006 07:49 GMT
I want my PPC app to be "network aware". Question is in two parts

1. How can i determine if the PPC in on a network?

2. How can i be alerted automatically, when network is detected?

Any ideas?

Jeppe Jespersen
Denmark
Lonifasiko - 10 Jan 2006 08:11 GMT
1. If you want to check if the PDA has network connectivity:

public static bool HasNetworkConnectivity()
       // Call this class as follows:  bool bResponse =
Net.IsWebAccessible;
       {
           HttpWebRequest hwrRequest;
           HttpWebResponse hwrResponse;
           string strUrl = @"http://www.microsoft.com/";
           bool bConnected = false;
           try
           {
               hwrRequest = (HttpWebRequest)WebRequest.Create(strUrl);
               hwrResponse =
(HttpWebResponse)hwrRequest.GetResponse();
               if (hwrResponse.StatusCode == HttpStatusCode.OK)
               {
                   bConnected = true;
               }
               hwrResponse.GetResponseStream().Close();
           }
           catch (WebException we)
           {
               bConnected = false;
           }
           catch (Exception ex)
           {
               bConnected = false;
           }
           finally
           {
               hwrRequest = null;
               hwrResponse = null;
           }
           return bConnected;
       }

Take also a look at ConnectionManager from OpenNETCF. I think it gives
you the ability to enumerate all connections of the device. If you need
that, tell me so that I can show you some code.

Hope it helps.

Regards.
Paul G. Tobey [eMVP] - 10 Jan 2006 16:34 GMT
I believe that the OpenNetCF.Net namespace also has the ability to tell you
when there's a change in the connectivity state of an Adapter.  As you might
imagine, "how do I tell if there's a network connection is asked almost
daily".  Do a search of the archives using GoogleGroups and read...

http://groups.google.com/group/microsoft.public.dotnet.framework.compactframewor
k?hl=en&lr=lang_en&ie=UTF-8&oe=UTF-8


Paul T.

> 1. If you want to check if the PDA has network connectivity:
>
[quoted text clipped - 40 lines]
>
> Regards.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.