This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Open port check from Logic Machine
#2
Use this to check if LM can connect to a certain TCP port or not.
Code:
function checktcp(ip, port)
  local sock = require('socket').tcp()
  sock:settimeout(1)
  local res, err = sock:connect(ip, port)
  sock:close()
  return res, err
end

-- change IP/PORT as needed
res, err = checktcp('192.168.1.1', 80)
if res then
  log('connect OK')
else
  log('connect ERROR', err)
end
Reply


Messages In This Thread
RE: Open port check from Logic Machine - by admin - 06.04.2021, 06:04

Forum Jump: