02.09.2020, 11:43
You can convert hex char codes to a string like this:
Then you need to send it before the actual command:
Note that anything between <> is not a string value but an ASCII character name, so 'PWR OFF<CR>' should actually be 'PWR OFF\r'
Code:
hs = string.char(0x45, 0x53, 0x43, 0x2F, 0x56, 0x50, 0x2E, 0x6E, 0x65, 0x74, 0x10, 0x03, 0x00, 0x00, 0x00, 0x00)
Then you need to send it before the actual command:
Code:
res, err = sock:send(hs)
res, err = sock:send(cmd)
Note that anything between <> is not a string value but an ASCII character name, so 'PWR OFF<CR>' should actually be 'PWR OFF\r'