Results 1 to 9 of 9

Thread: IsNetworkAlive function

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2008
    Posts
    3

    IsNetworkAlive function

    Hello,

    I'm writing a small app for a windows cd 5.0 device in .net 2005. This will be connected via Wifi.
    I am trying to determine when the device is connected to the network. The IsNetworkAlive api call works fine on a Windows 2000/xp pc (example follows)

    Private Declare Function IsNetworkAlive Lib "SENSAPI.DLL" (ByRef lpdwFlags As Long) As Long
    Const NETWORK_ALIVE_AOL = &H4
    Const NETWORK_ALIVE_LAN = &H1
    Const NETWORK_ALIVE_WAN = &H2

    Dim Ret As Long
    If IsNetworkAlive(Ret) = 0 Then
    MsgBox "The local system is not connected to a network!"
    Else
    MsgBox "The local system is connected to a " + IIf(Ret = NETWORK_ALIVE_AOL, "AOL", _
    IIf(Ret = NETWORK_ALIVE_LAN, "LAN", "WAN")) + " network!"
    End If


    Is it possible to do this on Windows CE?

    Thank you.

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: IsNetworkAlive function

    Hi.
    Why don't u use system.Net.Dns.GetHostName ?

    Or you can use inthehand classes http://inthehand.com/

    or you can construct your own API with and dll it for pocket pc
    Last edited by sapator; Jun 3rd, 2008 at 05:35 AM.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2008
    Posts
    3

    Re: IsNetworkAlive function

    Good question.

    I try it.

    Teo

  4. #4
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: IsNetworkAlive function

    Take a look here - excellent video on how to handle it
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  5. #5
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: IsNetworkAlive function

    Ok i have made a post on codebank that will try to simulate The IsNetworkAlive api. It gives info on the adapter and if it is connected.
    Just use my link in the signature.
    Last edited by sapator; Jun 3rd, 2008 at 08:09 AM.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  6. #6
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: IsNetworkAlive function

    Never mind,

    Just read that you are using Windows CE, suggested something for Windows Mobile.

  7. #7
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331

    Re: IsNetworkAlive function

    Hello,

    There is the SNAPI that has a classes called WIFIConnected, WIFIconnecting, and WIFIAvailable.

    I think this is all you need.

    Hope this helps,

    Steve
    steve

  8. #8
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: IsNetworkAlive function

    This is what I was going to suggest, but I thought that was only for Windows Mobile, not for Windows CE.

    Can you confirm?

    Thanks,

    Gary

  9. #9

    Thread Starter
    New Member
    Join Date
    Jun 2008
    Posts
    3

    Re: IsNetworkAlive function

    Hello,

    Thanks for the suggestions and sorry for the late reply.

    Everything works fine on windows mobile but on CE it doesn't work as expected.

    First of all SNAPI WIFIConnected, WIFIconnecting, and WIFIAvailable are not supported on CE. I used the OpenNETCF and the example found here
    http://msdn.microsoft.com/en-us/library/aa446491.aspx


    I tried the system.Net.Dns.GetHostName. I tried it when the device was in range and had connection and a network address and without.
    In both cases it takes very long to reply. About 35 seconds.

    The same result was when I tried intheHand component. It takes over 30 seconds to reply. I used the ping.send command. You can set the timeout parameter also.

    I tried intheHand component on a Windows mobile device. It works excellent.

    I think i've tried everything on the CE but i get the same result every time. It takes over 30 seconds to reply.
    I've installed compact framework sp2 also.

    Any idea would be appreciated.

    Thank you.
    Teo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width