locked
Check Network Connectivity and Internet Availability RRS feed

  • Question

  • Hi Experts,

    I want my application for smart device to check for network connectivity (i.e., whether within range) and internet availability.

    The following links serve part of my requirement:
    1. http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=67152&SiteID=1
    2. http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=693339&SiteID=1

    But still I am not able to find out if the device is running in flight mode. If I am not mistaken, then I think Internet and Network is not available in flight mode.

    Link #1 is a slower procedure to find internet availability. Is there a faster way to do it?

    Regards,
    Suman

    Tuesday, September 19, 2006 11:55 AM

All replies

  • Does this Link help...

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=728587&SiteID=1
    Tuesday, September 19, 2006 2:00 PM
  •  Tryst wrote:
    Does this Link help...

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=728587&SiteID=1


    Hi Tryst,

    Thanks so much for the link.

    I am able to test the function IsConnected and it works perfectly.

    But the function IsConnectedToInternet is not returning correct status? I have used it the same way as it has been shown in the sample. It always returns the status as connected to Internet. How to simulate a situation when it will return false? Even if I am setting the Pocket Pc device simulator to Flight mode, still it says its connected to internet. Please help me once again.

    Regards,
    Suman

    Wednesday, September 20, 2006 12:24 PM
  • Hi Suman,

    What is the device you are using to check the Internet Connection?
    The Code which i have used here is working perfectly in my Device and it shows false when its not connected.

    Can you let me know model of your Device. are u using this code in Smart Device or in PDA?

    Cheers
    Biju S Melayil

    Thursday, September 21, 2006 9:09 AM
  • Hi Biju,

    I am testing it in a Pocket PC 2003 SE Emulator [not a real Pocket PC Device]. I am debugging from Visual Studio 2005 and using C# to code.

    Regards,
    Suman

    Thursday, September 21, 2006 11:02 AM

  • Hi Suman,

    Iam testing this code in a device which has ce .NET as os. Iam using the SIM Card and gprs connection to check the internet conneciton and it works fine in tat.. 
    You might be getting error because its not real envoirnment and the code used here is an unmanaged code .

    This code is much faster as its checking some hardware and giving back the bool value.

    Regards
    Biju S Melayil..

    Thursday, September 21, 2006 5:33 PM
  • Hi Biju,

    Ok then I will keep using this function as you claim it to be faster than the normal way of checking internet availability. I will let it be like this till we deploy it on a real device.

    Thank you. I will get back to you if it still doesn't work.

    Regards,
    Suman
    Friday, September 22, 2006 7:31 AM
  • Hi Biju / Suman,

     

    I have a Windows mobile application and not web based. So how should I be checking the network connectivity whether available or not.

    Please suggest a solution.

     

    Thanks

     

    Praveen Ganjam

    Tuesday, August 7, 2007 4:43 AM


  • hi ,

    it seems there is  a point when ur application need to check the internet connectivity.
    In that case , ur device must be using GPRS.

    Please check the code below :


    public bool checkInet()
            {

                try
                {
                    System.Net.IPHostEntry obj = System.Net.Dns.GetHostEntry("www.yahoo.com");
                    return true;
                }
                catch
                {
                    return false; // host not reachable.
                }

    u can also check the link :

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=693328&SiteID=1


    -Aneesh
    Tuesday, August 7, 2007 2:28 PM
  • Hi

     

    Thanks so much for the information... But we are using a Windows based PDA application which may not have the GPRS connection but want to detect whether the PDA is in the local network or not... Any ideas please share it

     

    Thanks

     

    Praveen Ganjam

    Wednesday, August 8, 2007 10:02 AM
  • Thanks a lot! Aneesh Abraham

    Its very useful code to me and it satisfy my requirement.

    Once again Thanks!

    Sunday, October 16, 2011 6:05 AM