finding local IP?

Dar Scott dsc at swcp.com
Tue Dec 21 11:27:23 EST 2004


On Dec 21, 2004, at 2:14 AM, Thierry Arbellot wrote:

> 2 tricks for OS X and Win 2K
> theIPAddress is the local IP address of the computer
>
> MacOS X
>     put replaceText(shell("/sbin/ifconfig en0 | head -3 | grep 'inet ' 
> | cut -d' ' -f 2"),"(\s|\(|\))","") into theIPAddress
>
> Windows 2000/XP
>     put "255.255.255.255:43222" into testSocket
>     open datagram socket to testSocket
>     put hostAddress(testSocket) into theIPAddress
>     close socket testSocket

I think with 2.5, the latter will work on OS X!  It did just now on my 
system & Revolution 2.5, anyway.  Yay!

I'm too lazy to turn on the Mac OS 9 at the moment.

Dar
**********************************************
     DSC (Dar Scott Consulting & Dar's Lab)
     http://www.swcp.com/dsc/
     Programming Services and Software
**********************************************



More information about the use-livecode mailing list