+ * g_socket_connection_is_connected:
+ * @connection: a #GSocketConnection
+ *
+ * Checks if @connection is connected. This is equivalent to calling
+ * g_socket_is_connected() on @connection's underlying #GSocket.
+ *
+ * Returns: whether @connection is connected
+ *
+ * Since: 2.32
+ */
+gboolean
+g_socket_connection_is_connected (GSocketConnection *connection)
+{
+ return g_socket_is_connected (connection->priv->socket);
+}
+
+/**
+ * g_socket_connection_connect:
+ * @connection: a #GSocketConnection
+ * @address: a #GSocketAddress specifying the remote address.
+ * @cancellable: (allow-none): a %GCancellable or %NULL
+ * @error: #GError for error reporting, or %NULL to ignore.
+ *
+ * Connect @connection to the specified remote address.
+ *
+ * Returns: %TRUE if the connection succeeded, %FALSE on error
+ *
+ * Since: 2.32
+ */
+gboolean
+g_socket_connection_connect (GSocketConnection *connection,
+ GSocketAddress *address,
+ GCancellable *cancellable,
+ GError **error)
+{
+ g_return_val_if_fail (G_IS_SOCKET_CONNECTION (connection), FALSE);
+ g_return_val_if_fail (G_IS_SOCKET_ADDRESS (address), FALSE);
+
+ return g_socket_connect (connection->priv->socket, address,
+ cancellable, error);
+}
+
+static gboolean g_socket_connection_connect_callback (GSocket *socket,
+ GIOCondition condition,
+ gpointer user_data);
+
+/**
+ * g_socket_connection_connect_async:
+ * @connection: a #GSocketConnection
+ * @address: a #GSocketAddress specifying the remote address.
+ * @cancellable: (allow-none): a %GCancellable or %NULL
+ * @callback: (scope async): a #GAsyncReadyCallback
+ * @user_data: (closure): user data for the callback
+ *
+ * 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.
+ *
+ * Since: 2.32
+ */
+void
+g_socket_connection_connect_async (GSocketConnection *connection,
+ GSocketAddress *address,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GTask *task;
+ GError *tmp_error = NULL;
+
+ g_return_if_fail (G_IS_SOCKET_CONNECTION (connection));
+ g_return_if_fail (G_IS_SOCKET_ADDRESS (address));
+
+ task = g_task_new (connection, cancellable, callback, user_data);
+
+ g_socket_set_blocking (connection->priv->socket, FALSE);
+
+ if (g_socket_connect (connection->priv->socket, address,
+ cancellable, &tmp_error))
+ {
+ g_task_return_boolean (task, TRUE);
+ g_object_unref (task);
+ }
+ else if (g_error_matches (tmp_error, G_IO_ERROR, G_IO_ERROR_PENDING))
+ {
+ GSource *source;
+
+ g_error_free (tmp_error);
+ source = g_socket_create_source (connection->priv->socket,
+ G_IO_OUT, cancellable);
+ g_task_attach_source (task, source,
+ (GSourceFunc) g_socket_connection_connect_callback);
+ g_source_unref (source);
+ }
+ else
+ {
+ g_task_return_error (task, tmp_error);
+ g_object_unref (task);
+ }
+}
+
+static gboolean
+g_socket_connection_connect_callback (GSocket *socket,
+ GIOCondition condition,
+ gpointer user_data)
+{
+ GTask *task = user_data;
+ GSocketConnection *connection = g_task_get_source_object (task);
+ GError *error = NULL;
+
+ if (g_socket_check_connect_result (connection->priv->socket, &error))
+ g_task_return_boolean (task, TRUE);
+ else
+ g_task_return_error (task, error);
+
+ g_object_unref (task);
+ return FALSE;
+}
+
+/**
+ * g_socket_connection_connect_finish:
+ * @connection: a #GSocketConnection
+ * @result: the #GAsyncResult
+ * @error: #GError for error reporting, or %NULL to ignore.
+ *
+ * Gets the result of a g_socket_connection_connect_async() call.
+ *
+ * Returns: %TRUE if the connection succeeded, %FALSE on error
+ *
+ * Since: 2.32
+ */
+gboolean
+g_socket_connection_connect_finish (GSocketConnection *connection,
+ GAsyncResult *result,
+ GError **error)
+{
+ g_return_val_if_fail (G_IS_SOCKET_CONNECTION (connection), FALSE);
+ g_return_val_if_fail (g_task_is_valid (result, connection), FALSE);
+
+ return g_task_propagate_boolean (G_TASK (result), error);
+}
+
+/**