Oberon || Library || Module Index || Search Engine || Definition || Module
PROCEDURE GetHostName(VAR hostname: ARRAY OF CHAR); PROCEDURE GetDomainName(VAR domain: ARRAY OF CHAR); PROCEDURE GetFullyQualifiedHostName(VAR name: ARRAY OF CHAR);
PROCEDURE GetLocalIPv4Address(VAR ipaddr: IPv4Addresses.Address) : BOOLEAN; PROCEDURE GetLocalIPv6Address(VAR ipaddr: IPv6Addresses.Address) : BOOLEAN;
GetHostName returns the non-qualified hostname of the current host. Firstly, SysUname.GetNodeName is tried, and, if this fails, SysHost.GetHostName. If the hostname returned by either of these system calls includes a domain name, it is stripped off.
GetDomainName uses GetFullyQualifiedHostName to retrieve the fully qualified domain name and remove its host part.
GetFullyQualifiedHostName attempts to return the fully qualified hostname of the current host for which DNS address records exists to which local sockets can be bound to. It starts with the hostname returned by GetHostName and attempts to retrieve address records for it using DNSResolvers. If this fails, the environment variable LOCALDOMAIN is checked for and, if defined, combined with the unqualified hostname to retrieve DNS address records. If this fails as well, a final attempt is made using the domain name returned by SysHost.GetDomainName.
GetLocalIPv4Address and GetLocalIPv6Address return one of the address records that are defined for the hostname returned by GetFullyQualifiedHostName. They return FALSE if no such addresses exists. The selection is non-deterministic if multiple addresses exist.
Oberon || Library || Module Index || Search Engine || Definition || Module