read_nonblocking
Description:
Attempts to read up to buffer.length
bytes from this into buffer
, as with
read.
If this is not currently readable, this will immediately return g_io_error_would_block, and you can use create_source to create a SocketSource that will be triggered when this is readable.
Note that since this method never blocks, you cannot actually use cancellable
to cancel it. However, it will return an error if
cancellable
has already been cancelled when you call, which may happen if you call this method after a source triggers due to
having been cancelled.
The behaviour of this method is undefined if can_poll returns false for this.
Parameters:
this | |
buffer |
a buffer to read data into (which should be at least |
cancellable |
a Cancellable, or null |
count |
the number of bytes you want to read |
Returns:
the number of bytes read, or -1 on error (including g_io_error_would_block). |