Class: Gio::UnixConnection

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#receive_credentials(cancellable) ⇒ Gio::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.

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

This method can be expected to be available on the following platforms:

  • Linux since GLib 2.26

  • FreeBSD since GLib 2.26

  • GNU/kFreeBSD since GLib 2.36

  • Solaris, Illumos and OpenSolaris since GLib 2.40

  • GNU/Hurd since GLib 2.40

Other ways to exchange credentials with a foreign peer includes the GUnix::CredentialsMessage type and g_socket_get_credentials() function. g_object_unref()), nil if error is set.

Parameters:

Returns:

#receive_credentials_async(cancellable, callback, user_data) ⇒ nil

Asynchronously receive credentials.

For more details, see g_unix_connection_receive_credentials() which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call g_unix_connection_receive_credentials_finish() to get the result of the operation.

Parameters:

  • cancellable (Gio::Cancellable)

    optional #GCancellable object, nil to ignore.

  • callback (Gio::AsyncReadyCallback)

    a GAsync::ReadyCallback to call when the request is satisfied

  • user_data (GObject)

    the data to pass to callback function

Returns:

  • (nil)

#receive_credentials_finish(result) ⇒ Gio::Credentials

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

Parameters:

Returns:

  • (Gio::Credentials)

    a #GCredentials, or nil on error. Free the returned object with g_object_unref().

#receive_fd(cancellable) ⇒ Integer

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.

Parameters:

  • cancellable (Gio::Cancellable)

    optional #GCancellable object, nil to ignore

Returns:

  • (Integer)

    a file descriptor on success, -1 on error.

#send_credentials(cancellable) ⇒ TrueClass

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.

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

This method can be expected to be available on the following platforms:

  • Linux since GLib 2.26

  • FreeBSD since GLib 2.26

  • GNU/kFreeBSD since GLib 2.36

  • Solaris, Illumos and OpenSolaris since GLib 2.40

  • GNU/Hurd since GLib 2.40

Other ways to exchange credentials with a foreign peer includes the GUnix::CredentialsMessage type and g_socket_get_credentials() function.

Parameters:

Returns:

  • (TrueClass)

    true on success, false if error is set.

#send_credentials_async(cancellable, callback, user_data) ⇒ nil

Asynchronously send credentials.

For more details, see g_unix_connection_send_credentials() which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call g_unix_connection_send_credentials_finish() to get the result of the operation.

Parameters:

  • cancellable (Gio::Cancellable)

    optional #GCancellable object, nil to ignore.

  • callback (Gio::AsyncReadyCallback)

    a GAsync::ReadyCallback to call when the request is satisfied

  • user_data (GObject)

    the data to pass to callback function

Returns:

  • (nil)

#send_credentials_finish(result) ⇒ TrueClass

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

Parameters:

Returns:

  • (TrueClass)

    true if the operation was successful, otherwise false.

#send_fd(fd, cancellable) ⇒ TrueClass

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.

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.

Parameters:

  • fd (Integer)

    a file descriptor

  • cancellable (Gio::Cancellable)

    optional #GCancellable object, nil to ignore.

Returns:

  • (TrueClass)

    a true on success, nil on error.