Why No Built in GetMyIP call in LiveCode?

John Patten johnpatten at mac.com
Fri Jun 10 14:12:01 EDT 2011


Thanks for the quick replies!

I thought I had it figured out with Devin's suggestion. Everything  
seemed to work with this script:

on mouseUp
    put the hostname into tHostName
    --wait 1 sec
    put the hostnametoaddress of tHostName
end mouseUp

The address returned 10.58.0.109. However, when I went in and looked  
at my machines IP it was 10.58.0.42.

I wonder where it got the 10.x.x.109 from?


Mark, I'm assuming there is a shell script for Ubuntu too that will do  
the same parse action as your script example?  Your example should  
help me to understand how to parse the shell script.

Thank you!

John Patten
SUSD


On Jun 10, 2011, at 10:41 AM, Devin Asay wrote:

> John,
>
> Look at the hostName and hostNameToAddress functions
>
> put the hostNameToAddress of the hostName into fld "info"
>
> HTH
>
> Devin
>
> On Jun 10, 2011, at 11:05 AM, John Patten wrote:
>
>> Hi All...
>>
>> 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:
>>
>> on mouseUp
>>   open socket to "127.0.0.1:5005" with message "socketOpen"
>>   put the result
>> end mouseUp
>>
>> on socketOpen theSock
>>   put the hostAddress of "127.0.0.1:5005"
>> end socketOpen
>>
>> ...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
>> wireless.
>>
>> 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
>> current stack."
>>
>> Is this available in the dictionary and I'm just missing it?
>>
>> Thank you!
>>
>> John Patten
>> SUSD
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> Devin Asay
> Humanities Technology and Research Support Center
> Brigham Young University
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list