| 95 | // lookup functions |
| 96 | |
| 97 | int |
| 98 | get_local_hostname ( |
| 99 | std::string& hostname |
| 100 | ) |
| 101 | { |
| 102 | // ensure that WSAStartup has been called and WSACleanup will eventually |
| 103 | // be called when program ends |
| 104 | sockets_startup(); |
| 105 | |
| 106 | try |
| 107 | { |
| 108 | |
| 109 | char temp[NI_MAXHOST]; |
| 110 | if (gethostname(temp,NI_MAXHOST) == SOCKET_ERROR ) |
| 111 | { |
| 112 | return OTHER_ERROR; |
| 113 | } |
| 114 | |
| 115 | hostname = temp; |
| 116 | } |
| 117 | catch (...) |
| 118 | { |
| 119 | return OTHER_ERROR; |
| 120 | } |
| 121 | |
| 122 | return 0; |
| 123 | } |
| 124 | |
| 125 | // ----------------- |
| 126 |
nothing calls this directly
no test coverage detected