send


Description:

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

Tries to send buffer.length bytes from buffer on the socket.

This is mainly used by connection-oriented sockets; it is identical to send_to with address set to null.

If the socket is in blocking mode the call will block until there is space for the data in the socket queue. If there is no space available and the socket is in non-blocking mode a g_io_error_would_block error will be returned. To be notified when space is available, wait for the g_io_out condition. Note though that you may still receive g_io_error_would_block from send even if you were previously notified of a g_io_out condition. (On Windows in particular, this is very common due to the way the underlying APIs work.)

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

Parameters:

this

a Socket

buffer

the buffer containing the data to send.

cancellable

a gcancellable or null

size

the number of bytes to send

Returns:

Number of bytes written (which may be less than buffer.length), or -1 on error




2022 vala-language.org