hostNameToAddress not working???

Alex Tweedly alex at tweedly.net
Fri Feb 15 13:36:27 EST 2008


Dave wrote:
> Hi All,
>
> I have the following function:
>
> ------------------------------------------------------------------
> -- 
> --  Get the LAN IP Address of this Machine
> -- 
> ------------------------------------------------------------------
> function IPMGetHostIPAddressLAN
>   local myHostIPAddress
>
>   put hostNameToAddress(the hostName) into myHostIPAddress
>   return myHostIPAddress
> end IPMGetHostIPAddressLAN
>
>
> This used to work fine and return the local LAN address of the machine 
> the Script is running on, I just tried it and now it just returns empty.
>
> I originally cribbed this from Richmond's "Get IP Address" stack. I 
> download this again from rev online and it too fails. From this stack:
>
> on mouseUp
>   put "Public IP =" && url "http://xtalk.memebot.com/cgi-bin/ip.cgi" 
> into line 1 of fld "F1"
>   put "Local IP =" && hostnametoaddress ("localhost") into line 2 of 
> fld "F1"
>   put "LAN IP =" && hostnametoaddress(the hostname)  into line 3 of 
> fld "F1"
> end mouseUp
>
> When I run this I get "empty" as the LAN Address. The other two IP 
> address fields are filled in ok.
>
> Could anyone shed any light on why this has stopped working and how I 
> can obtain the LAN IP address?
>
Which machine ? OS ? Rev version ?

It would be interesting to see the output from
   put the hostname  && ":" && hostnametoaddress(the hostname)

to see whether the hostname has been set properly (and then to see 
whether the host name to address mapping is OK).

if you're on a Mac, try opening a terminal window, and look at the 
output from
    echo $HOSTNAME
if you're on a PC, ummmm .... I forget :-) - but look at what the system 
thinks the hostname is.

-- 

Alex Tweedly      mailto:alex at tweedly.net      www.tweedly.net




More information about the use-livecode mailing list