finding local IP?
thierry.arbellot at wanadoo.fr
Tue Dec 21 03:14:45 CST 2004
On Tuesday, Dec 21, 2004, at 09:40 Europe/Paris, kweto wrote:
> Hello All,
> Thanks to much kind advise, I can now create stacks that are able to
> interact over my school's LAN. Next step is to simplify my messy
> Question: Is there a Rev command (or elegant trick?) for retrieving the
> local IP address of the computer on which a stack is running?
> For the moment, my half-baked solution is to (1) use the router
> software to
> assign each computer a permanent IP address, and then (2) store those
> addresses as a text file. That way, each time a LAN-based stack opens
> retrieves its computer's IP address from that text file.
> There must be a better way, though!
> Nicolas Cueto
2 tricks for OS X and Win 2K
theIPAddress is the local IP address of the computer
put replaceText(shell("/sbin/ifconfig en0 | head -3 | grep 'inet '
| cut -d' ' -f 2"),"(\s|\(|\))","") into theIPAddress
put "255.255.255.255:43222" into testSocket
open datagram socket to testSocket
put hostAddress(testSocket) into theIPAddress
close socket testSocket
More information about the use-livecode