03.10.2024, 08:32
Hi!
I am trying to connect DENON Amplifier with TCP.
While I can send message successfully to DENON, I cannot receive reply from it.
With my laptop I tried TCP with telnet and confirmed that DENON gives back response to my terminal.
Following is what I have tried with resident script (interval = 0) but I got no message.
Thank you very much in advance!
I am trying to connect DENON Amplifier with TCP.
While I can send message successfully to DENON, I cannot receive reply from it.
With my laptop I tried TCP with telnet and confirmed that DENON gives back response to my terminal.
Following is what I have tried with resident script (interval = 0) but I got no message.
Thank you very much in advance!
Code:
if not server then
require('socket')
server = socket.udp()
server:setsockname('127.0.0.1', 5485)
end
if not tcp then
tcp = assert(socket.tcp())
local res, err = tcp:connect('192.168.0.1', 23)
if res then
return tcp
else
tcp:close()
return nil, err
end
end
function denon_receive(tcp)
res, err = tcp:receive()
if not res then
return nil, err
end
return res
end
while tcp do
res, err =denon_receive(tcp)
if res ~= nil then
log(res,err)
end
if (res == nil) then
log('no response')
end
end