Function SocketRecv() Professional

Receives data from a connected socket.

Syntax
SocketRecv( <nSocket>  , ;
            @<cBuffer> , ;
            [<nLength>], ;
            [<nFlag>]  , ;
            [@<nError>]  ) --> nBytesRead
Parameters
<nSocket>
This is a numeric socket descriptor identifying a connected socket.
<cBuffer>
A character string serving as buffer for the incoming data must be passed by reference.
<nLength>
Optionally, the number of bytes to read can be specified. This parameter defaults to Len(<cBuffer>).
<nFlag>
#define constants from the file SOCKET.CH are used for this parameter. It specifies the way in which the call is made.
Constants for data retrieval
Constant Description
MSG_NORMAL *) Copy incoming data to <cBuffer> and remove copied data from the input queue.
MSG_PEEK Copy incoming data to <cBuffer> and leave the data in the input queue.
MSG_OOB Process out-of-band data.
  1. default
<nError>
If this parameter is passed by reference to the function, it gets assigned a numeric error code when the function fails. #define constants beginning with WSAE are available in the file SOCKET.CH to identify an error condition.
Return

Returns the number of bytes read from the input queue or 0 in case of a failure.

Description

This function receives data on a connected datagram or stream socket and copies it into a buffer that must be passed by reference. The number of bytes read from the input queue is returned. If no data is available, the function blocks waiting for a message to arrive, unless the socket is in nonblocking mode. When a datagram is received that is too long to fit into the buffer, excess data is discarded.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.