E-MailRelay
Static Public Member Functions | List of all members
GNet::Local Class Reference

A static class for getting information about the local machine's network name and address. More...

#include <glocal.h>

Static Public Member Functions

static std::string hostname ()
 Returns the local hostname. Returns "localhost" on error. More...
 
static std::string canonicalName ()
 Returns the ASCII fully qualified domain name associated with hostname(). More...
 

Detailed Description

A static class for getting information about the local machine's network name and address.

Definition at line 38 of file glocal.h.

Member Function Documentation

◆ canonicalName()

std::string GNet::Local::canonicalName ( )
static

Returns the ASCII fully qualified domain name associated with hostname().

The result of the first call is 'memoised'.

On Unix the implementation performs a synchronous DNS query on the hostname() and returns the canonical name. The hostname and the returned canonical name are converted to A-labels if necessary.

On Windows the 'ComputerNameDnsFullyQualified' value is returned, also converted to A-labels if necessary.

Defaults to "<hostname-as-a-label>.localnet" or even "localhost.localnet" if the result would otherwise be invalid.

Definition at line 35 of file glocal_unix.cpp.

◆ hostname()

std::string GNet::Local::hostname ( )
static

Returns the local hostname. Returns "localhost" on error.

Definition at line 27 of file glocal_unix.cpp.


The documentation for this class was generated from the following files: