GUnixConnection

GUnixConnection — A UNIX domain GSocketConnection

Synopsis

#include <gio/gunixconnection.h>

                    GUnixConnection;
gint                g_unix_connection_receive_fd        (GUnixConnection *connection,
                                                         GCancellable *cancellable,
                                                         GError **error);
gboolean            g_unix_connection_send_fd           (GUnixConnection *connection,
                                                         gint fd,
                                                         GCancellable *cancellable,
                                                         GError **error);

Object Hierarchy

  GObject
   +----GIOStream
         +----GSocketConnection
               +----GUnixConnection

Description

This is the subclass of GSocketConnection that is created for UNIX domain sockets.

It contains functions to do some of the UNIX socket specific functionality like passing file descriptors.

Note that <gio/gunixconnection.h> belongs to the UNIX-specific GIO interfaces, thus you have to use the gio-unix-2.0.pc pkg-config file when using it.

Details

GUnixConnection

typedef struct _GUnixConnection GUnixConnection;


g_unix_connection_receive_fd ()

gint                g_unix_connection_receive_fd        (GUnixConnection *connection,
                                                         GCancellable *cancellable,
                                                         GError **error);

Receives a file descriptor from the sending end of the connection. The sending end has to call g_unix_connection_send_fd() for this to work.

As well as reading the fd this also reads a single byte from the stream, as this is required for fd passing to work on some implementations.

connection :

cancellable :

error :

Returns :

Since 2.22


g_unix_connection_send_fd ()

gboolean            g_unix_connection_send_fd           (GUnixConnection *connection,
                                                         gint fd,
                                                         GCancellable *cancellable,
                                                         GError **error);

Passes a file descriptor to the recieving side of the connection. The recieving end has to call g_unix_connection_receive_fd() to accept the file descriptor.

As well as sending the fd this also writes a single byte to the stream, as this is required for fd passing to work on some implementations.

connection :

fd :

cancellable :

error :

Returns :

Since 2.22

See Also

GSocketConnection.