MCPcopy Create free account
hub / github.com/davisking/dlib / get_local_hostname

Function get_local_hostname

dlib/sockets/sockets_kernel_2.cpp:81–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79 // lookup functions
80
81 int
82 get_local_hostname (
83 std::string& hostname
84 )
85 {
86 try
87 {
88 char temp[MAXHOSTNAMELEN];
89
90 if (gethostname(temp,MAXHOSTNAMELEN) == -1)
91 {
92 return OTHER_ERROR;
93 }
94 // ensure that NUL is at the end of the string
95 temp[MAXHOSTNAMELEN-1] = '\0';
96
97 hostname = temp;
98 }
99 catch (...)
100 {
101 return OTHER_ERROR;
102 }
103
104 return 0;
105 }
106
107// -----------------
108

Callers 1

thread_procMethod · 0.50

Calls

no outgoing calls

Tested by 1

thread_procMethod · 0.40