Method

GioSocketClientconnect_async

since: 2.22

Declaration [src]

void
g_socket_client_connect_async (
  GSocketClient* client,
  GSocketConnectable* connectable,
  GCancellable* cancellable,
  GAsyncReadyCallback callback,
  gpointer user_data
)

Description [src]

This is the asynchronous version of g_socket_client_connect().

You may wish to prefer the asynchronous version even in synchronous command line programs because, since 2.60, it implements RFC 8305 “Happy Eyeballs” recommendations to work around long connection timeouts in networks where IPv6 is broken by performing an IPv4 connection simultaneously without waiting for IPv6 to time out, which is not supported by the synchronous call. (This is not an API guarantee, and may change in the future.)

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

Available since: 2.22

This method completes asynchronously. Use g_socket_client_connect_finish() inside the GAsyncReadyCallback to obtain the result of the operation.

Parameters

connectable

Type: GSocketConnectable

A GSocketConnectable specifying the remote address.

The data is owned by the caller of the method.
cancellable

Type: GCancellable

A GCancellable, or NULL.

The argument can be NULL.
The data is owned by the caller of the method.
callback

Type: GAsyncReadyCallback

A GAsyncReadyCallback.

The argument can be NULL.
user_data

Type: gpointer

User data for the callback.

The argument can be NULL.
The data is owned by the caller of the method.