views:

93

answers:

3

I know about the IsNetworkAlive function from the Windows API but IsNetworkAlive returns false until there's any network activity.

That is, if you start your computer and test connectivity it will return false. If you then ping another computer (or recieve a ping or any network activity from another computer) then it will start returning true.

Is there any alternative or does anyone know a workaround for this?

Things I've tried so far:

  • Ping to the local host (no go as there isn't really any network activity)
  • Ping to the local address (the same as before)

Note: I know there's another question very similar to this one, but my problem here is with IsNetworkAlive behaviour

A: 

Consider using

Dzmitry Huba
Nice, but I'm using winapi, not .NET ... I don't have access to .NET
Jorge Córdoba
+1  A: 

Maybe this is what you want: Check network connection status using C#.net?

(It use InternetGetConnectedState WinInet function)

Regent
+1  A: 

The WinInet functions should meet your needs. Of particular interest is the InternetGetConnectedState function.

Mike J