gSocketSendMessage {RGtk2} | R Documentation

## gSocketSendMessage

### Description

Send data to `address` on `socket`. This is the most complicated and fully-featured version of this call. For easier use, see `gSocketSend` and `gSocketSendTo`.

### Usage

    gSocketSendMessage(object, address, vectors, messages = NULL,
        flags = 0, cancellable = NULL, .errwarn = TRUE)

### Arguments

``object`` | a `GSocket`
``address`` | a `GSocketAddress`, or `NULL`
``vectors`` | a list of `GOutputVector` structs
``messages`` | a pointer to a list of `GSocketControlMessages`, or `NULL`.
``flags`` | an int containing `GSocketMsgFlags` flags
``cancellable`` | a `GCancellable` or `NULL`
`.errwarn` | Whether to issue a warning on error or fail silently

### Details

If `address` is `NULL` then the message is sent to the default receiver (set by `gSocketConnect`). `vectors` must point to a list of `GOutputVector` structs and `num.vectors` must be the length of this list. (If `num.vectors` is -1, then `vectors` is assumed to be terminated by a `GOutputVector` with a `NULL` buffer pointer.) The `GOutputVector` structs describe the buffers that the sent data will be gathered from. Using multiple `GOutputVector`s is more memory-efficient than manually copying data from multiple sources into a single buffer, and more network-efficient than making multiple calls to `gSocketSend`. `messages`, if non-`NULL`, is taken to point to a list of `num.messages` `GSocketControlMessage` instances. These correspond to the control messages to be sent on the socket. If `num.messages` is -1 then `messages` is treated as a `NULL`-terminated array. `flags` modify how the message is sent. The commonly available arguments for this are available in the `GSocketMsgFlags` enum, but the values there are the same as the system values, and the flags are passed in as-is, so you can pass in system-specific flags too.

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 `gSocketSend` 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 `error` is set accordingly. Since 2.22

### Value

A list containing the following elements:

`retval` | [integer] Number of bytes written (which may be less than `size`), or -1 on error
``error`` | `GError` for error reporting, or `NULL` to ignore.

### Author(s)

Derived by RGtkGen from GTK+ documentation

[Package RGtk2 version 2.20.36.3 Index]