Next: , Previous: , Up: STClient: Consuming a Service   [Contents]


B.8.2.2 Starting a Client

Function: gboolean st_client_start (STClient *self, const gchar *address, guint16 port, GError **error)

Synchronous connect, snapshot, and subscribe. Blocks the calling thread.

self

Client.

address

Peer host/address string.

port

Peer’s real TCP port (not 0).

error

Filled on failure.

Returns: TRUE on success.

Function: void st_client_start_async (STClient *self, const gchar *address, guint16 port, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)

Asynchronous connect/snapshot/subscribe. Finish with st_client_start_finish.

self

Client.

address

Peer host/address.

port

Peer TCP port.

cancellable

Optional GCancellable, or NULL.

callback

Completion callback.

user_data

Closure data for callback.

Returns: Nothing.

Function: gboolean st_client_start_finish (STClient *self, GAsyncResult *result, GError **error)

Completes st_client_start_async.

self

Client.

result

Async result from the callback.

error

Filled on failure.

Returns: TRUE on success.

Function: void st_client_stop (STClient *self)

Disconnects and returns toward idle.

self

Client.

Returns: Nothing.

Function: gboolean st_client_swap (STClient *self, const gchar *address, guint16 port, GError **error)

Stops and reconnects to a new address/port (synchronous).

self

Client.

address

New peer address.

port

New peer port.

error

Filled on failure.

Returns: TRUE on success.