Question
· Feb 28, 2019

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
Discussion (1)0
Log in or sign up to continue