1. This returns my local IP address on all my machines not
   connected to my router:

get hostnametoaddress(hostname())

   But behind my router it returns empty.  Why?
   And what is the reliable way to obtain the local IP address?

Hi Richard,

Do you actually want the router's address (so people can connect to you from outside your firewall) or your own computer's address?


For getting the router's address, I log on to checkip.dyndns.org:

function routerIPaddress
put "http://checkip.dyndns.org/"; into theURL
put URL theURL into theData
get lineOffset("Current IP Address:", theData)
put last word of line it of theData into ipAddr
if ipAddr contains "<" then delete char offset("<", ipAddr) to -1 of ipAddr
return ipAddr
end routerIPaddress


Make sure it never gets called in rapid succession or they will blacklist you!

For getting my internal address, I use the method Dar described of opening a socket to a web site and then using the hostAddress function:

on mouseUp
put empty into fld "IP address"
put line 1 of hostnametoaddress("genesearch.com.au")& ":80|testSocket" \
into testSock
open socket to testSock with message "socketReady"
end mouseUp


on socketReady pSock
  put hostAddress(pSock) into fld "IP address"
  close socket pSock
end socketReady

Hope this helps,
Sarah

_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to