Why No Built in GetMyIP call in LiveCode?
johnpatten at mac.com
Fri Jun 10 12:05:14 CDT 2011
I've been looking at all the solutions in the archive for getting the
IP address of the machine running a stack. Some shell scripts, some
php calls, etc. etc.
I have a situation where we are behind a firewall using NAT. So all
our computers are running a 10.x.x.x.x address. I'm trying to
implement some socket communication between stacks and IP address
information is essential for this to work. I would like the
communication process set up to be as transparent as possible,
allowing users to connect by name and maybe holding IP address is a
custom property for example.
The Dictionary provides some examples for hostAdress function and I
tried (wishful thinking, script trickery) something like this:
open socket to "127.0.0.1:5005" with message "socketOpen"
put the result
on socketOpen theSock
put the hostAddress of "127.0.0.1:5005"
...but it just gave me 127.0.0.1 and not the 10.x.x.x. address...
Shell script works nice, but it gives quite a few IP in its result.
Plus the actual machine IP is located on different lines in the
result, such as in a desktop machine, as opposed to a laptop on
It just seems like it would be nice to have a built in function for
reporting local machine's IP...
Such as, "put localIP of current stack into tIP" or "get LocalIP of
Is this available in the dictionary and I'm just missing it?
More information about the use-livecode