boost::asio::ip::host_name() returns the local machine's hostname (a thin wrapper around POSIX gethostname(2) / Windows GetHostName). corosio currently has no equivalent — resolver_results::host_name() exists but returns the hostname associated with a resolved endpoint, which is a different thing.
This is a small but commonly used utility (greetings, logging, default Host: headers, cluster registration, identifying which node produced a log line).
Proposal
namespace boost::corosio {
std::string host_name();
}
Synchronous, no io_context needed. Same signature shape as asio's. Implementation is gethostname on POSIX and GetHostNameW / GetComputerNameExW on Windows.
Likely lives in a header like <boost/corosio/host_name.hpp> (or wherever the resolver-adjacent free functions land).
boost::asio::ip::host_name()returns the local machine's hostname (a thin wrapper around POSIXgethostname(2)/ WindowsGetHostName). corosio currently has no equivalent —resolver_results::host_name()exists but returns the hostname associated with a resolved endpoint, which is a different thing.This is a small but commonly used utility (greetings, logging, default
Host:headers, cluster registration, identifying which node produced a log line).Proposal
Synchronous, no
io_contextneeded. Same signature shape as asio's. Implementation isgethostnameon POSIX andGetHostNameW/GetComputerNameExWon Windows.Likely lives in a header like
<boost/corosio/host_name.hpp>(or wherever the resolver-adjacent free functions land).