Try OpenEdge Now
skip to main content
Programming Interfaces
External Program Interfaces : Sockets : Read, writing, and managing sockets on clients and servers : Reading data on a socket
 
Reading data on a socket
To read data from a connected TCP/IP socket, you invoke the READ( ) method on the corresponding socket object (SELF:READ( ) within the corresponding READ-RESPONSE event procedure). You can invoke this method on a connected socket at any time to read data. However, the method blocks depending on the amount of data available on the socket, the reading mode that you use, and the timeout value (set by the SO-RCVTIMEO option of the SET-SOCKET-OPTION() method).
This is the syntax of the READ( ) method:

Syntax

READ(
memptr-expression
, position
, bytes-to-read
[ , mode ]
)
The READ( ) method transfers data from the socket to the specified MEMPTR variable, memptr-expression, at the byte position in the MEMPTR region specified by the INTEGER expression, position. Exactly how much data the READ( ) method blocks to read depends on:
*The number of bytes specified by the INTEGERbytes-to-read
*The reading mode specified by the INTEGERmode
*The timeout value, set by the SO-RCVTIMEO option of the SET-SOCKET-OPTION() method
* Specifying the read mode
* Specifying the timeout length
* Verifying the number of bytes actually read