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