closed tcp conexion

This commit is contained in:
yago 2014-12-22 21:43:36 +01:00
parent aa7ac75d31
commit 7881f62e20

View File

@ -3,12 +3,15 @@ socket = require("socket")
function cron() function cron()
-- Checks a TCP connexion -- Checks a TCP connexion
-- Use yours desired web and id -- Use yours desired web and id
local addr = "your.web.site" local addr = "gul.es"
local dest = "user#id"..our_id local dest = "user#id"..our_id
if not socket.connect(addr, 80) then local connexion = socket.connect(addr, 80)
if not connexion then
local text = "ALERT: "..addr.." is offline" local text = "ALERT: "..addr.." is offline"
print (text) print (text)
send_msg(dest, text, ok_cb, false) send_msg(dest, text, ok_cb, false)
else
connexion:close()
end end
end end