Why No Built in GetMyIP call in LiveCode?

Bob Sneidar bobs at twft.com
Fri Jun 10 14:49:25 EDT 2011


So if you are using Apples, I wonder if there is a way to access the bonjour address? When I ping the name of my computer in terminal, with .local appended to the end I get the actual IP of the primary adapter. Now if I issue  the Livecode command put the hostname in the message box it returns the fully qualified domain name of my laptop lgos-mp-bobsneidar.cccm.lan, which confirms my suspicions that the hostname command is querying DNS. (My Mac laptop is joined to my active directory domain.) The only way for Livecode to discern THAT name is to query DNS. 

I do not like depending on DNS for hostnames and IP's. Firstly, if you have multiple disassociated domains, some devices will not be known by the particular DNS you are querying. Secondly, not everyone has an active directory domain, and so they use public DNS which will not register your local IP address. Thirdly, as I mentioned before, in a DHCP environment, your DNS records can become stale, especially if you have not done any internet access or contacted the AD DC since you got a new lease. Finally, if someone manually entered a DNS a record (like you have to do for Macs because unless joined to the domain they will not register themselves) and then later decide to change the computer name, and you forget to change the DNS A record, your query will return the wrong name. Ugh! 

I think however, you could fudge it. setting the lineDelimiter to period and then getting the first line of the FQDN returned by hostname will return the machine name without any domain info. For Macs append .local to that and ping it in a shell. For Windows, take the first 15 characters of the name and ping that. It will be the NETBIOS name of the machine. 

That is the best I can do for the moment without putting more thought into it. 

Bob


On Jun 10, 2011, at 11:20 AM, John Patten wrote:

> Actually Chris I wanted the local network, behind the firewall IP address. The project I have in mind is just using sockets in a single classroom. All computers have 10.x.x.x. addresses.
> 
> Thanks!
> 
> John Patten
> SUSD





More information about the use-livecode mailing list