lua-users home
lua-l archive

testing for network connection

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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

AltStyle によって変換されたページ (->オリジナル) /