How to ignore terminators on read from TCP device

I'm connecting to a remote device using TCP. It has a binary protocol.

set host = ""
set port = ""
set io = $io
set device = "|TCP|7000"

set timeout = 2
open device:(host:port:"M")
use device:(/IOT="RAW")
read string:timeout

use io
zzdump string

The problem is when reading from it, I get a 0A (also known as 10 or \n or linefeed) byte, which terminates the read.

Expected output:

0000: 42 00 7B 0A 11

But I get this output:

0000: 42 00 7B

How can I fix that?

 

Some additional info:

  • read completes in 0.1 seconds despite 2 seconds timeout.
  • $zb contains the value of 0D
  • 0
  • 0
  • 59
  • 0
  • 1

Answers