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 timeout length
 
Specifying the timeout length
Besides setting the read mode, you can also set the amount of time READ() waits before timing out. To do so, use the SO-RCVTIMEO option of the SET-SOCKET-OPTION() method. If you do not set a timeout value, the default is for READ() to wait forever.
READ()'s timeout behavior is affected by the interaction of the read mode and the timeout value, as the following table illustrates.
Table 68. Effect of read mode and timeout value on READ()'stimeout behavior
Read mode
With a timeout value
Without a timeout value
READ-AVAILABLE
Assuming there are no connection failures, READ() blocks until one of the following occurs:
*The timeout expires
*There is at least one byte available to read on the socket
Assuming there are no connection failures, READ() blocks until there is at least one byte available to read on the socket
READ-EXACT-NUM
Assuming there are no connection failures:
*If there is any data on the socket, READ() blocks until there are bytes-to-read bytes available to read on the socket
*Else, READ() blocks until the timeout expires
Assuming there are no connection failures, READ() blocks until there are bytes-to-read bytes available to read on the socket