Hi, I am working on a project which should access some files in the internet, so I would like to have a sort of "connection-test" to prevent the "unknown host" error to appear. How could I do that?
Thank you very much.
How to check internet connection without error message?
Moderator: MSandro
Re: How to check internet connection without error message?
Using an if-else maybe?... I don't know, you could try using cloud variables?
Re: How to check internet connection without error message?
Check out the "safelyRun" function in tasks.gp.
That will allow you to try to open a socket to a given host. If you provide an error function, it will be called if the attempt fails. Or, if you don't provide an error function, you'll get a Task object back if it fails or an ExternalReference back if it succeeds. So you can check the class of the returned value to figure out what happened.
That will allow you to try to open a socket to a given host. If you provide an error function, it will be called if the attempt fails. Or, if you don't provide an error function, you'll get a Task object back if it fails or an ExternalReference back if it succeeds. So you can check the class of the returned value to figure out what happened.