Check internet status

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
feelself
Posts: 8
Joined: Wed Aug 28, 2013 9:11 am

Check internet status

Post by feelself » Wed Aug 28, 2013 9:16 am

Hello, everyone. i need to do the project by live code to check the whether there have the internet connection, and then if have internet, then can update some new informations in , Anyone got any idea? Really confused now.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Check internet status

Post by Mark » Wed Aug 28, 2013 10:39 am

Hi,

There are several ways to do this. The easiest way is to put a tine file on your server, e.g. with just a "1", and check if you can download this file:

Code: Select all

put url "http://www.yourdomain.xyz/the1.htm" into myStatus
put the result into rslt
if rslt is not empty then
  beep
  answer error rslt
else if myStatus is 1 then
  // do your thing
else
  beep
  answer error "Sorry, an error occurred."
end if
In some cases, I've noticed that rslt would also contain the URL that is being contacted. I guess that is/was a bug. So, you might want to check for this as well:

Code: Select all

if rslt is not empty and not (rslt begins with "http") then
Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Check internet status

Post by Klaus » Wed Aug 28, 2013 11:09 am

Hi feelself,

please only ONE thread (in ONE forum) for the same question!
I deleted all other threads with your question!


Best

Klaus

Post Reply