boost::corosio::host_name
Return the local machine's hostname.
Synopsis
Declared in <boost/corosio/host_name.hpp>
std::string
host_name();
Description
On POSIX systems this calls gethostname(2). On Windows this calls GetComputerNameExW(ComputerNameDnsHostname, ...) and converts the result from UTF‐16 to UTF‐8.
The function is synchronous and does not require an io_context. On Windows it does not require winsock to have been initialized.
Exceptions
Name |
Thrown on |
|
If the underlying system call fails. |
Return Value
The hostname as a UTF‐8 string.
Created with MrDocs