read


Description:

public SocketIOStatus read (uint8[] buffer, out size_t nread, Cancellable? cancellable = null) throws Error

Attempts to read up to buffer.length bytes from this into buffer.

If some data is successfully read, read will return soup_socket_ok, and * nread will contain the number of bytes actually read (which may be less than buffer.length).

If this is non-blocking, and no data is available, the return value will be soup_socket_would_block. In this case, the caller can connect to the readable signal to know when there is more data to read. (NB: You MUST read all available data off the socket first. readable is only emitted after read returns soup_socket_would_block, and it is only emitted once. See the documentation for non_blocking.)

Parameters:

this

the socket

buffer

buffer to read into

nread

on return, the number of bytes read into buffer

cancellable

a Cancellable, or null

len

size of buffer in bytes

Returns:

a SocketIOStatus, as described above (or soup_socket_eof if the socket is no longer connected, or soup_socket_error on any other error, in which case throws will also be set).