The SockRecvFrom() call receives data on a socket.


>>--SockRecvFrom(socket, var, len--+-----------+--, address)-------------><
                                   +--, flags--+



is the socket descriptor.


is the name of a Rexx variable to receive the data.


is the maximum amount of data to be read.


is a blank delimited list of options:


reads any out-of-band data on the socket.


peeks at the data present on the socket. The data is returned but not consumed. The subsequent receive operation thus sees the same data.


is a stem variable specifying the address of the sender from which the data is received, unless it is a null address.

SockRecvFrom() receives data on a socket with descriptor socket and stores it in a Rexx variable named var. It applies to any socket type, whether connected or not.

SockRecvFrom() returns the length of the incoming message or data. If a datagram is too long to fit the supplied buffer, the excessive data is discarded. No data is discarded for stream sockets. If data is not available at socket, the SockRecvFrom() call waits for a message to arrive and blocks the caller, unless the socket is in nonblocking mode. See SockIoctl() for a description of how to set the nonblocking mode.

Return values:

If successful, the length of the data in bytes is returned. The value -1 indicates an error. You can get the specific error code SockSock_Errno() or SockPSock_Errno(). Possible values are:


socket is not a valid socket descriptor.


Invalid argument.


socket is in nonblocking mode, no data is available, or the SO_RCVTIMEO option has been set for socket and the timeout expired before data arrived.

Note: SockRecvFrom() interfaces with the C function recvfrom().