win32: how to detect if pc is 'connected' ?
Need to find a way to silently determine if a win32 pc is 'connected' to the internet. When I say silently, I mean it needs to not send any packets / establish connections / etc, because that would bring up the network connection dialog. InternetGetConnectedState() - no good, it reports the status of internet explorer, not the pc. IsDestinationReachable() - no good, sends icmp packets... GetNetworkParams() -> find out if they have a DNS server assigned? is it possible to have DNS server assigned without an active connection though? GetAdaptersInfo() -> just because they have an interface in the list doesnt mean that interface is connected...? Maybe GetBestInterface() to an arbitrary hardcoded address, and see if any non-loopback interface is returned?
[=^_^=]http://bani.anime.net/etpro/ - ETPro websitehttp://bani.anime.net/banimod/forums/ - ETPro discussion forums
This might happen just on my computer, but ping does not bring up a connection window when I use it without being connected (partly because it can be used to ping through a LAN as well as the Internet, I believe). It just fails with "no route to host".
Pinging uses the ICMP protocol, rather than the TCP protocol, so a connection isn't exactly established, but it can still be picked up by a firewall. You *might* be able to find something in the MSDN site, but I don't think there's any real way to find out, unless you create your own driver for creating network connections.
Why do you want to do this? What do you mean by 'connected'?
There's no way to do it in general because there's nothing to stop somebody from physically pulling the plug after everything has been setup to appear that you're on the net.
There's no way to do it in general because there's nothing to stop somebody from physically pulling the plug after everything has been setup to appear that you're on the net.
-Mike
Quote:
Original post by ToohrVyk
This might happen just on my computer, but ping does not bring up a connection window when I use it without being connected (partly because it can be used to ping through a LAN as well as the Internet, I believe). It just fails with "no route to host".
i wonder what GetBestInterface() returns in this case. this might be closest to what i'm looking for.
[=^_^=]http://bani.anime.net/etpro/ - ETPro websitehttp://bani.anime.net/banimod/forums/ - ETPro discussion forums
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement