|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Internet and Network > TCP-Client Commands > TCP-Client Operations |
SPR Script Language
TCP.LineInput
Reads a line of text, terminated by a newline, from an open TCP client connection.
Intention
The TCP.LineInput command is designed to read text-based protocols where data is exchanged line by line. It retrieves data from an active TCP connection ($$HND) until a newline character (CRLF) is encountered or the connection timeout occurs. The read line is stored in the specified variable ($$DAT).
Illustration
[Text Server]
|
v TCP/IP
TCP.LineInput <--- ("Line 1"$CRLF$) <--- (Streamed Data)
(Socket HND)
(Result Var)
Syntax
- This command reads text until it encounters a newline sequence (CRLF). The newline sequence itself is removed from the returned string.
- The timeout for this operation is inherited from the TCP.Open command used to establish the connection.
- The command pushes 0 to the stack if no data is received or no newline is found before the timeout, or if the connection is closed.
See also:
• TCP.Open
• TCP.Send
• TCP.Recv