Getting IP Address of Machine that is Currently Running the Stack

Eric Chatonet eric.chatonet at
Wed Oct 25 10:28:34 EDT 2006

Hi Dave,

Here is an example that might be easier to use:

local lIPAddress -- local script variable
function GetIPAddress
   local tInternetConnected
   put hostNameToAddress("") <> empty into  
   if tInternetConnected then
     put empty into lIPAddress
     open socket to "" with message "SocketOpen"
     wait until lIPAddress <> empty with messages
     return lIPAddress
   else return "Error: could not find an internet connection."
end GetIPAddress
on socketOpen
   put the hostAddress of "" into lIPAddress
   close socket ""
end socketOpen

You will use this code easily:

put GetIPAddress() into tCurMachineIPAddress

Of course you may use another domain than and another  
port than 443 as you like :-)
Have a look at hostNameToAddress, open socket,  close socket and  
hostAddress in the docs.

Best Regards from Paris,
Eric Chatonet

Le 25 oct. 06 à 16:06, jbv a écrit :

> Dave,
> I usually do that by sending a "get URL" request to a cgi script  
> (Rev cgi
> or php) that runs on a server and that returns the client IP.
> JB
>> Hi All,
>> How can I get the IP address of the machine that a stack is  
>> running on?

----------------------    eric.chatonet at

More information about the use-livecode mailing list