Actually, here, now, is a better version of [tt]GetNetworkState.sh[/tt] which uses a Lua script to, quite generally, find your IP address…
#! /usr/bin/env lua
--------------------------------------------------------------------------------
-- discover main IP address of machine and write to standard output
-- http://forums.coronalabs.com/topic/21105-found-undocumented-way-to-get-your-devices-ip-address-from-lua-socket/
--------------------------------------------------------------------------------
local socket = require "socket"
function myIP ()
local mySocket = socket.udp ()
mySocket:setpeername ("42.42.42.42", "424242") -- arbitrary IP and PORT
local ip = mySocket:getsockname ()
mySocket: close()
return ip or "127.0.0.1"
end
io.write (myIP())
--------
if you have multiple versions of Lua installed, you may need to change the first line to:
#! /usr/bin/env lua5.1
This should be much better than having to craft a file specifically for your own machine IP - I’ll put it in the next distribution.