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

Daryl Williams daryl at synergetic-data.com
Thu Jun 13 17:52:03 EDT 2013


According to the the dictionary:

openSockets: Returns a list of the currently open sockets.

I believe they mean on the localhost, although it doesn't specifically 
say so.

I think you will need to use the shell command to ping whatever 
address(es) you had in mind. On a class C, or 24 bit CIDR network there 
may be up to 254 addresses in use. If you wanted to check them all you 
would have to loop through the address range with something like the 
following:

put "192.168.1" into myNetwork

repeat with ipOctet = 1 to 254
     put shell("ping -c1 " & myNetwork & ipOctet) into tResult
     if tResult is not empty then
         -- check result
     end if
end repeat

Please note the "-c 1" option passed to ping, this will cause ping to 
send only one packet. By default on unix platforms ping will continue 
until interrupted, on windows ping quits after 4 packets have been sent. 
Either way be aware that your script will block until the repeat 
sequence is done unless you do this as a message event.

If on the other hand you have a set of known clients you provide a 
service to and you just want to see if they are around, you could send 
out a broadcast packet on the network (address 255) and have the clients 
available answer up when they get it.

Hope this is of some help.

Daryl



On 6/13/13 2:13 PM, dunbarx at aol.com wrote:
> Richard.
>
>
> Would the "openSockets" function do what you need? Not as direct as what OS9 could do, but those days are over. And I am sure there must be an appleScript gadget that could query the network.
>
>
>
> Craig Newman
>
>
> -----Original Message-----
> From: Dr. Hawkins <dochawk at gmail.com>
> To: How to use LiveCode <use-livecode at lists.runrev.com>
> Sent: Thu, Jun 13, 2013 5:02 pm
> Subject: a *fast* check for whether another machine is on the local network?
>
>
> 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.
>





More information about the use-livecode mailing list