%SS_RECVFROM

Receive bytes from a datagram socket (IPv4)

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
status = %SS_RECVFROM(socket, buf, bytes_received, [in_port, in_addr][, SS_MSG_PEEK])

Return value

status

Returns SS_SUCCESS (0) or one of the errors in Error codes returned by %SS_RECVFROM below. (n)

Arguments

socket

A descriptor of an open socket created by %SS_SOCKET. (i4)

buf

Buffer returned with the incoming data. (a)

bytes_received

Returned with the number of bytes received and placed into buf. (i4)

in_port

(optional) Returned with the internet port of the sending socket. (i4)

in_addr

(optional) Returned with the IPv4 address of the sending socket. (i4)

Note

If either in_port or in_addr is passed, they must both be passed.

SS_MSG_PEEK

(optional) Peek into the data that is next in line to be received without removing it from the system’s buffers. (n)

Discussion

%SS_RECVFROM reads incoming data from a bound datagram socket where there has not been a previous call to %SS_CONNECT. (%SS_CONNECT establishes a permanent peer address.) It optionally returns the source port and IP address.

%SS_RECVFROM extracts data from the first queued datagram up to the size of buf. If the datagram is larger than buf, the overflow data is lost, and the error SS_EMSGSIZE is returned. If no incoming data is available at the socket, %SS_RECVFROM blocks until data arrives.

If you call this function on a connected stream socket, it functions identically to %SS_RECV.

Error codes returned by %SS_RECVFROM

See the Socket Errors table for additional information about these errors.

SS_EBADF

SS_ECONNABORTED

SS_ECONNRESET

SS_EINTR

SS_EMSGSIZE

SS_ENETDOWN

SS_ENOBUFS

SS_ENOTCONN

SS_ENOTSOCK

SS_EUNKNOWN

SS_NOTINITIALISED