sendingCommand = 0
function sendCommand(ipAddress,port,command)
sendingCommand = 1
conn=net.createConnection(net.TCP, 0)
conn:connect(port,ipAddress)
conn:send(command)
conn:on("sent", function(c) c:close() print("Command Sent") sendingCommand = 0 end)
conn:on("disconnection", function(c) print("Connection Closed") end)
while sendingCommand == 1 do
tmr.wdclr()
end
print("Finished")
end
sendCommand("xxx.xxx.xxx.xxx",x,"Hello")
When I call this command I never break out of the while loop because the callback for sent is never fired. I am new to LUA and unsure of it's interrupt priorities with these callbacks.