You can't do ping directly from LC - LC only supports UDP and TCP sockets, not ICMP or raw.

You could do it via shell - but too many devices may not respond to ping.

Do you want to find all active IP addresses on your own subnet, or on any arbitrary subnet ?
If it's on your own, then here's what I'd do

- try opening a UDP socket to each IP address
- use shell / arp to see what's there.

every device should respond to an arp request, so this is much more likely to find all active devices.

If you prefer code (I took a shortcut and cheated on the subnet range, but you can fix that easily :-)
on mouseUp
   put empty into field "F"
   repeat with i = 1 to 255
      put "192.168.1." & i & ":8080" into tSocket
      open datagram socket to tSocket
   end repeat
   put shell("arp -n -a") into temp
   filter temp without "*(incomplete)*"
   put temp into field "F"
end mouseUp

If you want to do it for arbitrary subnets that you may not be on, then I can't offhand think of anything better than shell/ping.

-- Alex.

On 21/01/2011 20:52, Robert Brenstein wrote:
A weekend challenge for those who are bored, but not only...

I wonder whether it is possible to have a livecode stack that scans all IP addresses within a specific subnet to check whether devices are there. I am currently using Remote Desktop to do those scans manually but this is becoming boring and I'd like to run them more regularly, that is to automate the process.

For each scan, I need to get the list of active IP adresses in a specific subnet and the corresponding MAC addresses and hostnames (hostnames is easy with the hostaddresstoname function in livecode). I gather I could try opening a socket to some specific port. However, this needs to work with Macs (OS9 and OSX), Windows, Linux, NAS, printers, and cross switches to other subnets. Good old ping might suffice but how to do it in livecode?

The solution can be OSX-specific since it will run either under OSX Tiger or Leopeard (no Snow). Something like an automated IP Scan or Angry IP Scanner made in LiveCode. Using NMap through a shell call would be acceptable.

Robert

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to