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.

Blinds Control - Multiple Socket Connections Per Script
#3
Hi Erwin,

That still didn't work either .. the first command executes however the second one does not.

Even in a really simple example, the second command doesn't execute with the added \r.  For example


Code:
function sendCommand(command)
  local socket = require("socket").tcp()
  data, err = socket:connect('192.168.1.200', 4999)
  data, err = socket:send(command .. '\x0D\x0A' .. '\r') 
end

sendCommand('0113U'); 
os.sleep(1)
log('Sleep 1')
sendCommand( '0113S'); 
log('Sleep 2')



If I split this into two separate scripts and run the first one, then the second one a second later the commands execute as expected - however if I call sendCommand twice from the same script, the second calls fails (and I never see 'Sleep 2' in the logs.

Any idea why this would be happening?

Kind Regards
James
Reply


Messages In This Thread
RE: Blinds Control - Multiple Socket Connections Per Script - by jamesng - 09.02.2020, 09:14

Forum Jump: