Defining a name for a Connection

This commit is contained in:
brunoherbelin
2020-10-23 21:54:45 +02:00
parent 509416d5a0
commit db0892d25b
5 changed files with 53 additions and 20 deletions

View File

@@ -156,3 +156,12 @@ std::string NetworkToolkit::closest_host_ip(const std::string &ip)
return address;
}
std::string NetworkToolkit::hostname()
{
char hostname[1024];
hostname[1023] = '\0';
gethostname(hostname, 1023);
return std::string(hostname);
}