Jump to content
  • Advertisement
Sign in to follow this  

win32: how to detect if pc is 'connected' ?

This topic is 4885 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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".

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!