Ciao Chris,
For me, the only system is to query an external server.
I made a simple php script in my server:
[php]
<?php
$ip=$\_SERVER["REMOTE\_ADDR"];
echo $ip;
?\>
[/php]
Check this temp link:
[http://www.ikysasoft.com/onlyforguruk.php](http://www.ikysasoft.com/onlyforguruk.php)
Lua code:
[lua]local function getIP(params)
local url = params.url
local timeOut = params.timeOut or 0
local onEvent = params.onEvent
local ipAddress = nil
local isConnectedToInternet = nil
local isTimeOut = nil
local timerTimeOut
local function goEvent ()
if type( onEvent ) == "function" then
onEvent {
isConnectedToInternet = isConnectedToInternet,
ipAddress = ipAddress,
isTimeOut = isTimeOut,
}
end
end
local function listener(event)
if isTimeOut == nil then
if timerTimeOut then
timer.cancel(timerTimeOut)
end
isTimeOut = false
if event.isError == false then
isConnectedToInternet = true
if event.status == 200 then
if event.response and event.response ~= "" then
ipAddress = event.response
end
end
else
isConnectedToInternet = false
end
goEvent ()
end
end
network.request(url , "GET", listener)
if timeOut \> 0 then
local function listenerTimerTimeOut (event)
if timerTimeOut then
timer.cancel(timerTimeOut)
end
isTimeOut = true
goEvent ()
end
timerTimeOut = timer.performWithDelay(timeOut\*1000, listenerTimerTimeOut, 1)
end
end
local function onGetIP (params)
if params.isTimeOut == true then
native.showAlert( "Timeout", "")
else
if params.isConnectedToInternet then
native.showAlert( "Connected to Internet", "Your IP: "..params.ipAddress)
else
native.showAlert( "NOT Connected to Internet", "")
end
end
end
getIP({
url = "http://www.ikysasoft.com/onlyforguruk.php",
timeOut = 4, --secs
onEvent = onGetIP
})[/lua]
Sorry for my english.
ciao
Simone
btw: I am interested on your implementation of dropbox.... if you have some news... ceo at ikysasoft.com ;) [import]uid: 53768 topic\_id: 26266 reply\_id: 106596[/import]