testing for network connection
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: testing for network connection
- From: Wesley Smith <wesley.hoke@...>
- Date: 2009年7月24日 12:15:38 -0700
I'm in need of an efficient function for testing whether or not I have
a valid connection to the outside world. My likely naive attempt is
as follows:
function have_connection()
local tcp = socket.connect("google.com", 80)
if(not tcp) then
return false
else
tcp:close()
return true
end
end
Anyone know of a more efficient/effective method?
thanks,
wes