NetworkAddress.parse

Creates a new GSocketConnectable for connecting to the given hostname and port. May fail and return NULL in case parsing host_and_port fails. host_and_port may be in any of a number of recognised formats: an IPv6 address, an IPv4 address, or a domain name (in which case a DNS lookup is performed). Quoting with [] is supported for all address types. A port override may be specified in the usual way with a colon. Ports may be given as decimal numbers or symbolic names (in which case an /etc/services lookup is performed). If no port is specified in host_and_port then default_port will be used as the port number to connect to. In general, host_and_port is expected to be provided by the user (allowing them to give the hostname, and a port overide if necessary) and default_port is expected to be provided by the application. Since 2.22

class NetworkAddress
static
parse
(,)

Parameters

hostAndPort string

the hostname and optionally a port

defaultPort ushort

the default port if not in host_and_port

Return Value

the new GNetworkAddress, or NULL on error

Throws

GException on failure.

Meta