Is there an internet connection

I would like to add code to my application to test whether there is an active internet connection or not.
My application does some internet related functionality and I want to be sure that there is a connection prior to executing this functionality.

I can find lots of routines...but which is the best method?
geocoins-softwareAsked:
Who is Participating?
 
ziolkoCommented:
0
 
JoWickermanCommented:
HI,

Perform a ping to test connectivity.

ping microsoft.com

I used it once... Although it was in VB.

Hope this is useful.

Cheers,
0
 
geocoins-softwareAuthor Commented:
How about some code on how to do it?
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
JoWickermanCommented:
Well... VB code is:

My.Computer.Network.Ping("207.46.232.182")

Cheers
0
 
geocoins-softwareAuthor Commented:
well, im not looking for VB code.....and since this is a Delphi zone......enough said.
0
 
geocoins-softwareAuthor Commented:
I used InternetGetConnectedState - it works great - thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.