%SS2_RECVFROM

Receive bytes from a datagram socket (IPv6)

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

Return value

status

Returns SS_SUCCESS (0) or one of the errors in Error codes returned by %SS2_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_addr6

(optional) Returned with the IPv6 address of the sending socket. ([#]byte)

Note

If either in_port or in_addr6 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

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

%SS2_RECVFROM extracts data from the first queued datagram up to the size of buf. If the datagram is larger than the size of buf, the overflow data is lost, and the error SS_EMSGSIZE is returned. If no incoming data is available at the socket, %SS2_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 %SS2_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