Method
GioSocketsend_message_with_timeout
since: 2.60
Declaration [src]
GPollableReturn
g_socket_send_message_with_timeout (
GSocket* socket,
GSocketAddress* address,
const GOutputVector* vectors,
gint num_vectors,
GSocketControlMessage** messages,
gint num_messages,
gint flags,
gint64 timeout_us,
gsize* bytes_written,
GCancellable* cancellable,
GError** error
)
Description [src]
This behaves exactly the same as g_socket_send_message(), except that
the choice of timeout behavior is determined by the timeout_us argument
rather than by socket‘s properties.
On error G_POLLABLE_RETURN_FAILED is returned and error is set accordingly, or
if the socket is currently not writable G_POLLABLE_RETURN_WOULD_BLOCK is returned. bytes_written will contain 0 in both cases.
Available since: 2.60
Parameters
address-
Type:
GSocketAddressA
GSocketAddress, orNULL.The argument can be NULL.The data is owned by the caller of the method. vectors-
Type: An array of
GOutputVectorAn array of
GOutputVectorstructs.The length of the array is specified in the num_vectorsargument.The data is owned by the caller of the method. num_vectors-
Type:
gintThe number of elements in
vectors, or -1. messages-
Type: An array of
GSocketControlMessage*A pointer to an array of
GSocketControlMessages, orNULL.The argument can be NULL.The length of the array is specified in the num_messagesargument.The data is owned by the caller of the method. num_messages-
Type:
gintNumber of elements in
messages, or -1. flags-
Type:
gintAn int containing
GSocketMsgFlagsflags, which may additionally contain other platform specific flags. timeout_us-
Type:
gint64The maximum time (in microseconds) to wait, or -1.
bytes_written-
Type:
gsize*Location to store the number of bytes that were written to the socket.
The argument will be set by the function. The argument can be NULL. cancellable-
Type:
GCancellableA %GCancellable or
NULL.The argument can be NULL.The data is owned by the caller of the method. error-
Type:
GError **The return location for a recoverable error.
The argument can be NULL.If the return location is not NULL, then you must initialize it to aNULLGError*.The argument will be left initialized to NULLby the method if there are no errors.In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.
Return value
Type: GPollableReturn
G_POLLABLE_RETURN_OK if all data was successfully written,
G_POLLABLE_RETURN_WOULD_BLOCK if the socket is currently not writable, or
G_POLLABLE_RETURN_FAILED if an error happened and error is set.