a *fast* check for whether another machine is on the local network?

Dar Scott dsc at swcp.com
Thu Jun 13 17:52:32 EDT 2013


On Jun 13, 2013, at 3:02 PM, Dr. Hawkins wrote:

> Is there a *fast* way to see if another machine is currently on the
> local network, by name (somemachine.local) or otherwise, from within
> livecode?
> 
> There's always sending a message and waiting for it to hang, but I'd
> like something that happens quickly.

On OS X:  

You can use shell("arp -a") and look whether the IP address is included.  The list associates the underlying Ethernet address with the IP address.  It will expire after 20 minutes of non use.  So, this really means this computer talked to that computer in the last 20 minutes.  

I think the best way has to involve a message.  To keep it fast, use an IP address rather than the host name.  Use a method with a fast timeout.

You might be able to use shell(" ping -c 1 -t 1 10.9.8.7") but that would take a second if the computer is not there.  

If you have a service set up on that computer then you might be able to try that.

On Windows:  

Similar


Dar


---------------------------
Dar Scott
dba 
Dar Scott Consulting
8637 Horacio Place NE
Albuquerque, NM 87111

Lab, home, office phone: +1 505 299 9497
For Skype and fax, please contact.
dsc at swcp.com

Computer programming and tinkering,
usually in supporting those developing in 
LiveCode--typically by making LiveCode 
controls, libraries and externals, and
sometimes by writing associated
microcontroller firmware.  
---------------------------










More information about the use-livecode mailing list