READ( ) method
Reads data from the socket.
Return type: LOGICAL
Applies to: Socket object handle
buffer
position
bytes-to-read
mode
An optional integer expression that specifies howbytes-to-read
should be interpreted. Table 94 shows the valid values for this parameter. The default value is READ-EXACT-NUM (2).
READ( ) returns TRUE if the read operation succeeded normally and returns FALSE otherwise. An error can occur if:
This read statement is a blocking read. If
mode
is READ-EXACT-NUM, this method returns when it has either read the requested number of bytes from the socket or an error occurs. Ifmode
is READ-AVAILABLE, this method returns when it has read as many bytes as are currently available on the socket, up to the requested number of bytes, or an error occurs.If the READ( ) method succeeds, the variable buffer contains the data which is read from the socket. It is possible that the socket will not contain the specified number of bytes of data which were requested. The BYTES-READ attribute can be used to determine the number of bytes read from the socket.
This method expects
buffer
to identify a MEMPTR variable which already has a region of memory associated with it. The developer must call the SET-SIZE statement to allocate memory and associate it with a MEMPTR variable. It is the responsibility of the developer to free this memory, also via the SET-SIZE statement. The READ method will fail if the size ofbuffer
is less thanbytes-to-read
.
OpenEdge Release 10.2B
|