#!/usr/bin/lua local invoker = require 'invoker' local ipaddr = type(arg[1]) == "string" and arg[1] or 'mqtt.lnxall.com' local portno = 3883 if type(arg[2]) == "string" then local pno = tonumber(arg[2]) if pno then portno = pno end end io.stdout:write(string.format("TCP checking %s:%d...\n", ipaddr, portno)) io.stdout:flush() print(invoker.tcpcheck(ipaddr, portno)) io.stdout:flush() io.stderr:flush() os.exit(0)