UnixConnection

This is the subclass of gio.socket_connection.SocketConnection that is created for UNIX domain sockets.

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

Since GLib 2.72, gio.unix_connection.UnixConnection is available on all platforms. It requires underlying system support (such as Windows 10 with AF_UNIX) at run time.

Before GLib 2.72, <gio/gunixconnection.h> belonged to the UNIX-specific GIO interfaces, thus you had to use the gio-unix-2.0.pc pkg-config file when using it. This is no longer necessary since GLib 2.72.

Members

Functions

receiveCredentials
gio.credentials.Credentials receiveCredentials(gio.cancellable.Cancellable cancellable)

Receives credentials from the sending end of the connection. The sending end has to call gio.unix_connection.UnixConnection.sendCredentials (or similar) for this to work.

receiveCredentialsAsync
void receiveCredentialsAsync(gio.cancellable.Cancellable cancellable, gio.types.AsyncReadyCallback callback)

Asynchronously receive credentials.

receiveCredentialsFinish
gio.credentials.Credentials receiveCredentialsFinish(gio.async_result.AsyncResult result)

Finishes an asynchronous receive credentials operation started with gio.unix_connection.UnixConnection.receiveCredentialsAsync.

receiveFd
int receiveFd(gio.cancellable.Cancellable cancellable)

Receives a file descriptor from the sending end of the connection. The sending end has to call gio.unix_connection.UnixConnection.sendFd for this to work.

sendCredentials
bool sendCredentials(gio.cancellable.Cancellable cancellable)

Passes the credentials of the current user the receiving side of the connection. The receiving end has to call gio.unix_connection.UnixConnection.receiveCredentials (or similar) to accept the credentials.

sendCredentialsAsync
void sendCredentialsAsync(gio.cancellable.Cancellable cancellable, gio.types.AsyncReadyCallback callback)

Asynchronously send credentials.

sendCredentialsFinish
bool sendCredentialsFinish(gio.async_result.AsyncResult result)

Finishes an asynchronous send credentials operation started with gio.unix_connection.UnixConnection.sendCredentialsAsync.

sendFd
bool sendFd(int fd, gio.cancellable.Cancellable cancellable)

Passes a file descriptor to the receiving side of the connection. The receiving end has to call gio.unix_connection.UnixConnection.receiveFd to accept the file descriptor.

Inherited Members

From SocketConnection

factoryLookupType
gobject.types.GType factoryLookupType(gio.types.SocketFamily family, gio.types.SocketType type, int protocolId)

Looks up the #GType to be used when creating socket connections on sockets with the specified family, type and protocol_id.

factoryRegisterType
void factoryRegisterType(gobject.types.GType gType, gio.types.SocketFamily family, gio.types.SocketType type, int protocol)

Looks up the #GType to be used when creating socket connections on sockets with the specified family, type and protocol.

connect
bool connect(gio.socket_address.SocketAddress address, gio.cancellable.Cancellable cancellable)

Connect connection to the specified remote address.

connectAsync
void connectAsync(gio.socket_address.SocketAddress address, gio.cancellable.Cancellable cancellable, gio.types.AsyncReadyCallback callback)

Asynchronously connect connection to the specified remote address.

connectFinish
bool connectFinish(gio.async_result.AsyncResult result)

Gets the result of a gio.socket_connection.SocketConnection.connectAsync call.

getLocalAddress
gio.socket_address.SocketAddress getLocalAddress()

Try to get the local address of a socket connection.

getRemoteAddress
gio.socket_address.SocketAddress getRemoteAddress()

Try to get the remote address of a socket connection.

getSocket
gio.socket.Socket getSocket()

Gets the underlying #GSocket object of the connection. This can be useful if you want to do something unusual on it not supported by the #GSocketConnection APIs.

isConnected
bool isConnected()

Checks if connection is connected. This is equivalent to calling gio.socket.Socket.isConnected on connection's underlying #GSocket.