writev_nonblocking


Description:

[ Version ( since = "2.60" ) ]
public PollableReturn writev_nonblocking (OutputVector[] vectors, out size_t bytes_written, Cancellable? cancellable = null) throws Error

Attempts to write the bytes contained in the vectors.length vectors to this, as with writev.

If this is not currently writable, this will immediately return %G_POLLABLE_RETURN_WOULD_BLOCK, and you can use create_source to create a SocketSource that will be triggered when this is writable. throws will *not* be set in that case.

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.

Also note that if g_pollable_return_would_block is returned some underlying transports like D/TLS require that you re-send the same vectors and vectors.length in the next write call.

The behaviour of this method is undefined if can_poll returns false for this.

Parameters:

this

a PollableOutputStream

vectors

the buffer containing the OutputVectors to write.

bytes_written

location to store the number of bytes that were written to the stream

cancellable

a Cancellable, or null

n_vectors

the number of vectors to write

Returns:

%G_POLLABLE_RETURN_OK on success, g_pollable_return_would_block if the stream is not currently writable (and throws is *not* set), or g_pollable_return_failed if there was an error in which case throws will be set.