Hi
Im trying to communicate with a new HDMI Matrix device directly via IP, over port 23 and while I can send a command ok, I cant seem to capture the response thats supposed to be being sent back.
Doing some research online, I found the following post that suggests I couldnt send and receive in the same connection when its a Telnet /port 23 session ?
[url=https://stackoverflow.com/questions/32085919/lua-telnet-send-receive]sockets - Lua Telnet Send & Receive - Stack Overflow
Is that true? If so how could I get around that ?
Below are two of the LUA code examples Ive tried, but both are fine with the send, but just result in a timeout/no response.
Any help would be greatly appreciated
[code]function SYHDMIA1TO8()
local socket = require(“socket”)
local host, port = “192.168.102.252”, 23
local tcp = assert(socket.tcp())
tcp:connect(host, port);
–note the newline below
tcp:send(string.char(0x3E,0x40,0x57,0x56,0x53,0x4F,0x5B,0x31,0x5D,0x49,0x5B,0x36,0x5D,0x0D));
while true do
local s, status, partial = tcp:receive()
print(s or partial)
if status == “closed” then break end
end
tcp:close()
SYHDMIA1TO8()[/code]
[code]function SYHDMIA1TO8()
local socket = require(“socket”)
host = “192.168.102.252”
c = assert(socket.connect(host, 23))
c:settimeout(5)
local sres, serr = c:send(string.char(0x3E,0x40,0x57,0x56,0x53,0x4F,0x5B,0x31,0x5D,0x49,0x5B,0x38,0x5D,0x0D))
print(“Send:”, sres, serr)
local data, rerr = c:receive(100)
luup.log (data)
print (“Receive:”, data, rerr)
c:close()
end
SYHDMIA1TO8()
[/code]