UnixConnection

open class UnixConnection(pointer: <Error class: unknown class><<Error class: unknown class>>) : SocketConnection

This is the subclass of class@Gio.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, GUnixConnection 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.

Since

2.22

Constructors

Link copied to clipboard
constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val gioIOStreamPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
val gioSocketConnectionPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
val gioUnixConnectionPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard

The class@Gio.InputStream to read from.

Link copied to clipboard

The class@Gio.OutputStream to write to.

Link copied to clipboard
open val socket: Socket

The underlying class@Gio.Socket.

Functions

Link copied to clipboard
open fun clearPending()

Clears the pending flag on @stream.

Link copied to clipboard
open fun close(cancellable: Cancellable? = null): <Error class: unknown class><Boolean>

Closes the stream, releasing resources related to it. This will also close the individual input and output streams, if they are not already closed.

Link copied to clipboard
open fun closeAsync(ioPriority: <Error class: unknown class>, cancellable: Cancellable? = null, callback: AsyncReadyCallback?)

Requests an asynchronous close of the stream, releasing resources related to it. When the operation is finished @callback will be called. You can then call g_io_stream_close_finish() to get the result of the operation.

Link copied to clipboard
open fun closeFinish(result: AsyncResult): <Error class: unknown class><Boolean>

Closes a stream.

Link copied to clipboard
open fun connect(address: SocketAddress, cancellable: Cancellable? = null): <Error class: unknown class><Boolean>

Connect @connection to the specified remote address.

Link copied to clipboard
open fun connectAsync(address: SocketAddress, cancellable: Cancellable? = null, callback: AsyncReadyCallback?)

Asynchronously connect @connection to the specified remote address.

Link copied to clipboard
open fun connectFinish(result: AsyncResult): <Error class: unknown class><Boolean>

Gets the result of a g_socket_connection_connect_async() call.

Link copied to clipboard
open fun getLocalAddress(): <Error class: unknown class><SocketAddress>

Try to get the local address of a socket connection.

Link copied to clipboard
open fun getRemoteAddress(): <Error class: unknown class><SocketAddress>

Try to get the remote address of a socket connection.

Link copied to clipboard
open fun hasPending(): Boolean

Checks if a stream has pending actions.

Link copied to clipboard
open fun isClosed(): Boolean

Checks if a stream is closed.

Link copied to clipboard
open fun isConnected(): Boolean

Checks if @connection is connected. This is equivalent to calling g_socket_is_connected() on @connection's underlying #GSocket.

Link copied to clipboard
open fun receiveCredentials(cancellable: Cancellable? = null): <Error class: unknown class><Credentials>

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

Link copied to clipboard
open fun receiveCredentialsAsync(cancellable: Cancellable? = null, callback: AsyncReadyCallback?)

Asynchronously receive credentials.

Link copied to clipboard
open fun receiveCredentialsFinish(result: AsyncResult): <Error class: unknown class><Credentials>

Finishes an asynchronous receive credentials operation started with g_unix_connection_receive_credentials_async().

Link copied to clipboard
open fun receiveFd(cancellable: Cancellable? = null): <Error class: unknown class><<Error class: unknown class>>

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.

Link copied to clipboard
open fun sendCredentials(cancellable: Cancellable? = null): <Error class: unknown class><Boolean>

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

Link copied to clipboard
open fun sendCredentialsAsync(cancellable: Cancellable? = null, callback: AsyncReadyCallback?)

Asynchronously send credentials.

Link copied to clipboard
open fun sendCredentialsFinish(result: AsyncResult): <Error class: unknown class><Boolean>

Finishes an asynchronous send credentials operation started with g_unix_connection_send_credentials_async().

Link copied to clipboard
open fun sendFd(fd: <Error class: unknown class>, cancellable: Cancellable? = null): <Error class: unknown class><Boolean>

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

Link copied to clipboard
open fun setPending(): <Error class: unknown class><Boolean>

Sets @stream to have actions pending. If the pending flag is already set or @stream is closed, it will return false and set

Link copied to clipboard
open fun spliceAsync(stream2: IoStream, flags: IoStreamSpliceFlags, ioPriority: <Error class: unknown class>, cancellable: Cancellable? = null, callback: AsyncReadyCallback?)

Asynchronously splice the output stream of @stream1 to the input stream of