received bytes, or NULL on error
Socket.receiveBytes
glib.bytes.Bytes receiveBytes(size_t size, long timeoutUs, gio.cancellable.Cancellable cancellable = null)Receives data (up to size bytes) from a socket.
This function is a variant of [gio.socket.Socket.receive] which returns a [glib.bytes.Bytes] rather than a plain buffer.
Pass -1 to timeout_us to block indefinitely until data is received (or the connection is closed, or there is an error). Pass 0 to use the default timeout from [gio.socket.Socket.timeout], or pass a positive number to wait for that many microseconds for data before returning [gio.types.IOErrorEnum.TimedOut].
Parameters
size | the number of bytes you want to read from the socket |
timeoutUs | the timeout to wait for, in microseconds, or -1 to block indefinitely |
cancellable | a [gio.cancellable.Cancellable], or NULL |
Returns
a bytes buffer containing the
Throws
[ErrorWrap]