21 Internet protocol [internet]

21.18 Host name functions [internet.host.name]

string host_name(); string host_name(error_code& ec); template<class Allocator> basic_string<char, char_traits<char>, Allocator> host_name(const Allocator& a); template<class Allocator> basic_string<char, char_traits<char>, Allocator> host_name(const Allocator& a, error_code& ec);

Returns: The standard host name for the current machine, determined as if by POSIX gethostname.

Remarks: In the last two overloads, ill-formed unless allocator_traits<Allocator>::value_type is char.