Checking if internet is connected using tsNet?
Bob Sneidar
bobsneidar at iotecdigital.com
Mon Jul 30 11:29:03 EDT 2018
It's simple: Shell this command:
telnet <yourserverorip> <25>
eg:
telnet smtp.gmail.com 25
You should get a response. SMTP servers will respond with information about the SMTP server. Other connections will simply reply that you are connected. If you get nothing, there is nothing listening at that IP on that port.
Another thing you can do is open a socket, then check the openSockets. Pretty much the same thing, but no data is returned. (that I know of)
I open a socket then check the openSockets every second for 5 seconds, exiting upon success. Afterwards I alert the user and give them a chance to remedy the situation and try again, or else bail out.
If I understand this, the first method, telnet, is blocking so you have to wait for a timeout. The second is non blocking, hence the 5 second loop. Usually if my server is available I get an open socket right away. I call this function every time I attempt a connection the the SQL database. Otherwise, if I don't properly close the last connection, I can get these 1 minute delays while the SQL database times out.
Bob S
> On Jul 28, 2018, at 09:42 , Douglas Ruisaard via use-livecode <use-livecode at lists.runrev.com> wrote:
>
> Bob...
>
> Wondering if you would post the windows-version of this technique again... or copy it to this forum, ideally?
>
> The dropbox entry I can find is expired.
More information about the use-livecode
mailing list