Checking for an internet connectio

Tim Jones tolistim at me.com
Sun Apr 29 14:04:19 EDT 2012


Urgh - autocorrect sux!

	The actual text may "vary" from one OS update to another

Tim

On Apr 29, 2012, at 11:02 AM, Tim Jones wrote:

> Pete,
> 
> It's a good idea to always check the error code returned from a shell command.  The actual text may various from one OS update to another, so depending of the text returned can be a quick way to introduce an odd "bug" that works on one platform, but not on another.  The man page will describe the returned values.  If they are the text values (like ENOSPC, or EINVAL), you can look those up in the errno.h file (usually in /usr/include/sys/errno.h).
> 
> Since ping returns data on both a failure and a success, checking for an empty tResult would always result in a "failure" as written.
> 
> Tim
> 
> On Apr 29, 2012, at 10:49 AM, Peter Haworth wrote:
> 
>> Hi Phil,
>> Double checking on the code below in your script.  The man page for ping in
>> OS X and Linux say that ping has an exit code of zero if no errors are
>> encountered.  Should the test on tResult be for zero or have you found that
>> empty works too?
>> 
>> Thanks,
>> Pete
>> lcSQL Software <http://www.lcsql.com>
>> 
>> On Sat, Apr 28, 2012 at 12:30 PM, Phil Davis <revdev at pdslabs.net> wrote:
>> 
>>> -- check for connection failure
>>>  if tResult <> empty
>>>  then return false -- failed
>>>  else -- connected, but how well?
>>> 
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list