Checking for an internet connectio

Peter Haworth pete at lcsql.com
Tue May 1 19:06:55 EDT 2012


Hi Tim,
I've been trying this procedure out today and it seems to work just fine,
at least on a Mac, even though  the man page for ping says it returns zero
if successful, not empty and the procedure is treating any non-empty result
as failure.  Not sure why taht is.
Pete
lcSQL Software <http://www.lcsql.com>



On Sun, Apr 29, 2012 at 11:02 AM, Tim Jones <tolistim at me.com> 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