receive


Description:

public ssize_t receive (uint8[] buffer, Cancellable? cancellable = null) throws Error

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

On error -1 is returned and throws is set accordingly.

receive can return any number of bytes, up to buffer.length. If more than buffer.length bytes have been received, the additional data will be returned in future calls to receive.

If there is no data available, a g_io_error_would_block error will be returned.

Parameters:

this

the stream

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 stream

Returns:

Number of bytes read, or 0 if the end of stream reached, or -1 on error.




2022 vala-language.org