Gio.SocketListener.prototype.add_address
function add_address(address: Gio.SocketAddress, type: Gio.SocketType, protocol: Gio.SocketProtocol, source_object: GObject.Object): [ok: Boolean, effective_address: Gio.SocketAddress] { // Gjs wrapper for g_socket_listener_add_address() }
Creates a socket of type type and protocol protocol, binds it to address and adds it to the set of sockets we're accepting sockets from.
Note that adding an IPv6 address, depending on the platform, may or may not result in a listener that also accepts IPv4 connections. For more deterministic behavior, see Gio.SocketListener.prototype.add_inet_port.
source_object will be passed out in the various calls to accept to identify this particular source, which is useful if you're listening on multiple addresses and do different things depending on what address is connected to.
If successful and effective_address is non-null then it will be set to the address that the binding actually occurred at. This is helpful for determining the port number that was used for when requesting a binding to port 0 (ie: "any port"). This address, if requested, belongs to the caller and must be freed.
Since 2.22
- address
- type
- protocol
- source_object
Optional GObject.Object identifying this source
- ok
true on success, false on error.
- effective_address
location to store the address that was bound to, or null.