Class: Gio::SocketConnection

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

Instance Method Summary collapse

Instance Method Details

#connect(address, cancellable) ⇒ TrueClass

Connect connection to the specified remote address.

Parameters:

Returns:

  • (TrueClass)

    true if the connection succeeded, false on error

#connect_async(address, cancellable, callback, user_data) ⇒ nil

Asynchronously connect connection to the specified remote address.

This clears the #GSocket:blocking flag on connection’s underlying socket if it is currently set.

Use g_socket_connection_connect_finish() to retrieve the result.

Parameters:

  • address (Gio::SocketAddress)

    a GSocket::Address specifying the remote address.

  • cancellable (Gio::Cancellable)

    a %GCancellable or nil

  • callback (Gio::AsyncReadyCallback)

    a GAsync::ReadyCallback

  • user_data (GObject)

    user data for the callback

Returns:

  • (nil)

#connect_finish(result) ⇒ TrueClass

Gets the result of a g_socket_connection_connect_async() call.

Parameters:

Returns:

  • (TrueClass)

    true if the connection succeeded, false on error

#is_connectedTrueClass

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

Returns:

  • (TrueClass)

    whether connection is connected

#local_addressGio::SocketAddress

Try to get the local address of a socket connection.

Returns:

  • (Gio::SocketAddress)

    a GSocket::Address or nil on error. Free the returned object with g_object_unref().

#remote_addressGio::SocketAddress

Try to get the remote address of a socket connection.

Since GLib 2.40, when used with g_socket_client_connect() or g_socket_client_connect_async(), during emission of %G_SOCKET_CLIENT_CONNECTING, this function will return the remote address that will be used for the connection. This allows applications to print e.g. “Connecting to example.com (10.42.77.3)…”.

Returns:

  • (Gio::SocketAddress)

    a GSocket::Address or nil on error. Free the returned object with g_object_unref().

#socketGio::Socket

Returns socket.

Returns:

#socket=(socket) ⇒ Gio::Socket

Parameters:

Returns: