30.09.2016, 11:02
Try adding client:close() after client:send(cmd). But it all depends on how TCP server is created, it might still refuse connections for some time even when close is called. You might want to have and always-open TCP connection and do reconnect if send fails because remote TCP server might disconnect clients on timeout. This is all in theory and should be tested :) If close does not solve this issue I'll provide an example with automatic retry.