Sign in to follow this  

checking if there is an internet connection?

This topic is 4665 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

Ask the user. If they connect through dialup, they may not be connected currently but may want to, and in any case may have very particular ideas regarding whether they want your program accessing the internet or not.

Share this post


Link to post
Share on other sites
I'm making an application that needs to open a certain website. So can't I just check myself if there is an internet connection or not? If not I can warn the user that I will not be able to connect to that website?

Share this post


Link to post
Share on other sites
Again: just ask the user. That way, he'll either know that your program is accessing a website, or be able to decide that it shouldn't.

If the access is caused by a user's explicit action and should be obvious (like if the user selected "Open MyProgram home page..." from the help menu) then you can reasonably assume that the user wants you to make a connection and that you are able to. Otherwise, ask.

Share this post


Link to post
Share on other sites
There appear to be Windows functions to do this sort of stuff. Check out InternetCheckConnection to determine if you can connect to a website. Or you can try creating a socket and connecting manually, but this is probably simpler. There's also InternetGetConnectedState to determine the Internet connection state, as well as functions to connect via dialup. The documentation seems light on details, though.

Share this post


Link to post
Share on other sites

This topic is 4665 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this