mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-02 07:23:41 +02:00
gsocket: add g_socket_send_messages()
Allows sending of multiple messages (packets, datagrams) in one go using sendmmsg(), thus drastically reducing the number of syscalls when sending out a lot of data, or when sending out the same data to multiple recipients. https://bugzilla.gnome.org/show_bug.cgi?id=719646
This commit is contained in:
@@ -425,6 +425,41 @@ struct _GOutputVector {
|
||||
gsize size;
|
||||
};
|
||||
|
||||
/**
|
||||
* GOutputMessage:
|
||||
* @address: (allow-none): a #GSocketAddress, or %NULL
|
||||
* @vectors: pointer to an array of output vectors
|
||||
* @num_vectors: the number of output vectors pointed to by @vectors.
|
||||
* @bytes_sent: initialize to 0. Will be set to the number of bytes
|
||||
* that have been sent
|
||||
* @control_messages: (array length=num_control_messages) (allow-none): a pointer
|
||||
* to an array of #GSocketControlMessages, or %NULL.
|
||||
* @num_control_messages: number of elements in @control_messages.
|
||||
*
|
||||
* Structure used for scatter/gather data output when sending multiple
|
||||
* messages or packets in one go. You generally pass in an array of
|
||||
* #GOutputVectors and the operation will use all the buffers as if they
|
||||
* were one buffer.
|
||||
*
|
||||
* If @address is %NULL then the message is sent to the default receiver
|
||||
* (as previously set by g_socket_connect()).
|
||||
*
|
||||
* Since: 2.44
|
||||
*/
|
||||
typedef struct _GOutputMessage GOutputMessage;
|
||||
|
||||
struct _GOutputMessage {
|
||||
GSocketAddress *address;
|
||||
|
||||
GOutputVector *vectors;
|
||||
guint num_vectors;
|
||||
|
||||
guint bytes_sent;
|
||||
|
||||
GSocketControlMessage **control_messages;
|
||||
guint num_control_messages;
|
||||
};
|
||||
|
||||
typedef struct _GCredentials GCredentials;
|
||||
typedef struct _GUnixCredentialsMessage GUnixCredentialsMessage;
|
||||
typedef struct _GUnixFDList GUnixFDList;
|
||||
|
Reference in New Issue
Block a user