receive_with_blocking


Description:

[ Version ( since = "2.26" ) ]
public ssize_t receive_with_blocking (uint8[] buffer, bool blocking, Cancellable? cancellable = null) throws Error

This behaves exactly the same as receive, except that the choice of blocking or non-blocking behavior is determined by the blocking argument rather than by this's properties.

Parameters:

this

a Socket

buffer

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

blocking

whether to do blocking or non-blocking I/O

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