Read Command

The READ command may be used to obtain data from a socket.A READ operation terminates if any of the following are detected, in the order specified below:

Terminating Condition

Argument Contains

$Device

$Key (Continued)

Error

Empty string

Error string

Empty string

Timeout

Data received before timeout

Empty string

Empty string

Delimiter

Data up to, but not including the delimiter

Empty string

Delimiter string

Fixed length met

String of fixed length

Empty string

Empty string

Buffer emptied

One (1) to as many characters as happen to be provided by the transport interface

Empty string

Empty string

A non-fixed-length read, with no timeout and no delimiters requires a complex implementation of sequence of READs to ensure a predictable result. This is because the transport layer stream fragments delivered to the reader has only accidental correspondence with the operations performed by the writer. For example, the following

    Write "Message 1","Message 2"
    

is presented to the reader as the stream "Message1Message2" but it can take from one (1) to 18 READ commands to retrieve the entire stream.