16.03.2016, 08:25
You can use this function to check if given TCP port on your device is accepting connections:
Code:
function socketping(ip, port, timeout)
local sock = require('socket').tcp()
sock:settimeout(timeout or 2)
local res, err = sock:connect(ip, port)
sock:close()
return res, err
end
IP = '192.168.1.10'
PORT = 55000
status = socketping(IP, PORT)