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

Function get_local_hostname

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

Source from the content-addressed store, hash-verified

55 // lookup functions
56
57 int
58 get_local_hostname (
59 std::string& hostname
60 )
61 {
62 try
63 {
64 char temp[MAXHOSTNAMELEN];
65
66 if (gethostname(temp,MAXHOSTNAMELEN) == -1)
67 {
68 return OTHER_ERROR;
69 }
70 // ensure that NUL is at the end of the string
71 temp[MAXHOSTNAMELEN-1] = '\0';
72
73 hostname = temp;
74 }
75 catch (...)
76 {
77 return OTHER_ERROR;
78 }
79
80 return 0;
81 }
82
83// -----------------
84

Callers 1

thread_procMethod · 0.50

Calls

no outgoing calls

Tested by 1

thread_procMethod · 0.40