NetworkAddress.loopback


Description:

[ CCode ( has_construct_function = false , type = "GSocketConnectable*" ) ]
[ Version ( since = "2.44" ) ]
public NetworkAddress.loopback (uint16 port)

Creates a new SocketConnectable for connecting to the local host over a loopback connection to the given port.

This is intended for use in connecting to local services which may be running on IPv4 or IPv6.

The connectable will return IPv4 and IPv6 loopback addresses, regardless of how the host resolves `localhost`. By contrast, NetworkAddress will often only return an IPv4 address when resolving `localhost`, and an IPv6 address for `localhost6`.

get_hostname will always return `localhost` for a NetworkAddress created with this constructor.

Parameters:

port

the port

Returns:

the new NetworkAddress