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 : Specifying the read mode
 
Specifying the read mode
You can specify mode using a compiler constant as shown in the following table.
Table 67. Socket reading modes
Compiler constant
Value
Description
READ-AVAILABLE
1
The READ( ) method blocks until at least one (1) byte is available on the socket and reads the number of bytes that are available up to a maximum of bytes-to-read bytes.
READ-EXACT-NUM
2
(Default) The READ( ) method blocks until bytes-to-read bytes are available to read from the socket.
Thus, you can have the READ( ) method block until exactly the specified number of bytes are read (the default), or until all available bytes are read up to a maximum number allowed.
The appropriate reading mode to use depends on your application requirements. Note, however, that if you specify READ-EXACT-NUM, the READ( ) method blocks until it reads the specified number of bytes (no matter how long it takes) or until the socket is disconnected (whatever happens first).