receive_from


Description:

public ssize_t receive_from (out SocketAddress address, uint8[] buffer, Cancellable? cancellable = null) throws Error

Receive data (up to buffer.length bytes) from a socket.

If address is non-null then address will be set equal to the source address of the received packet. address is owned by the caller.

See receive for additional information.

Parameters:

this

a Socket

address

a pointer to a SocketAddress pointer, or null

buffer

a buffer to read data into (which should be at least buffer.length bytes long).

cancellable

a gcancellable or null

size

the number of bytes you want to read from the socket

Returns:

Number of bytes read, or 0 if the connection was closed by the peer, or -1 on error