I have connected my Rotel-RSP 1068 receiver (RS232 port) to a shareable TCP-server. If I use a normal TCP client program on a Windows PC. I can read status change and write HEX command to client and then turn on / off, change volume.
Example: Turn On receiver HEX - FE 03 A1 10 4B FF
How can I do this in a script and then update received data to a text file.
I use a Raspberry PI (Stretch) for Domoticz
I found this code which connects to the TCP server
Code: Select all
local host, port = "192.168.10.134", 10232
local socket = require("socket")
local tcp = assert(socket.tcp())
tcp:connect(host, port);
while true do
local s, status, partial = tcp:receive()
print(s or partial)
if status == "closed" then break end
end
tcp:close()
But I get a Error that the script has been running for more than 10sec
And it continues to connect to server as multiple client. So if I don't set allow client to 1 on the server, it will continue to connect as multiple client's
So I need a "If connected then stop connecting" and a way to send HEX command from dummy switches