How to ping?

Ben Rubinstein benr_mc at cogapp.com
Wed Mar 19 14:59:00 EST 2003


Dar,

Thanks for your reply.

>> - how could I (can I?) code a 'ping' function in Rev?
> 
> Use shell.

I foolishly forgot to mention that the spare computers that I have available
are Mac OS 9 (or earlier!) so I don't think shell is an option here.

>> - what is the lowest impact method that I could use, in
>> Revolution, to
>> probe a network device?
> 
> If you can have two telnet sessions at the same time on your router,
> then do an open test to that port.  Be sure and close it.  The two is
> so your usual maintenance and the testing do not interfere.
> 
> If it has http control and you never use it, then use that port instead.
> 
> There has been some discussion on how to make an open timeout.  (Use
> send.)  In your case you may not need that; don't bother with callbacks
> in that case.  If you don't create an open timeout, then the open will
> timeout in 21 seconds on some Windows (maybe all) and 75 seconds on OS
> X.

That sounds like my best option - I'll have to check if the telnet sessions
would be an issue - we keep a console running from the router's serial port,
so I hope that would be unaffected.  I haven't operated with sockets before,
so please bear with me while I push a bit further:

My guess is that if, if I can find a spare telnet or http port that doesn't
muck anything else up, I can get away with something like the following:

    * doing an open socket to the appropriate port, with an ID that I
      can match to the time I attempted the open

    * if the open succeeds, I close the socket and check how long it took
      to open - I would assume (though testing should demonstrate) that
      when things are operating normally this should take a few seconds at
      most.  If it's much longer, I'll record this as an failure (or at
      least amber condition)

    * if the open fails with 'socketError' then I can record this as a
      failure

Does this sound like a plan?  What I'm unclear about is whether there are
conditions in which the open can fail without socketError?  And if so is
there likely to be a problem if this is repeated thousands of times a day?

Also, the docs are unclear as to how I can access the ID that I can
optionally specify when opening the socket.  Presumably this is appended to
the parameter to the callback message?  (Forgive me if your response is to
"try it and you'll see", but I'm no longer at the office.)


Thanks again for your help,
 
  Ben Rubinstein               |  Email: benr_mc at cogapp.com
  Cognitive Applications Ltd   |  Phone: +44 (0)1273-821600
  http://www.cogapp.com        |  Fax  : +44 (0)1273-728866




More information about the use-livecode mailing list