Method

GioSocketConnectionget_remote_address

since: 2.22

Declaration [src]

GSocketAddress*
g_socket_connection_get_remote_address (
  GSocketConnection* connection
  GError** error
)

Description [src]

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)…”.

Available since: 2.22

Return value

Type: GSocketAddress

A GSocketAddress or NULL on error. Free the returned object with g_object_unref().

The caller of the method takes ownership of the returned data, and is responsible for freeing it.