Gio.SocketConnection.prototype.get_remote_address

function get_remote_address(): Gio.SocketAddress {
    // Gjs wrapper for g_socket_connection_get_remote_address()
}
  

Try to get the remote address of a socket connection.

Since GLib 2.40, when used with Gio.SocketClient.prototype.connect or Gio.SocketClient.prototype.connect_async, during emission of Gio.SocketClientEvent.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)...".

Since 2.22

Returns

a Gio.SocketAddress or null on error. Free the returned object with GObject.Object.prototype.unref.