diff options
author | Dwight <dmerriman@gmail.com> | 2008-12-04 14:33:18 -0500 |
---|---|---|
committer | Dwight <dmerriman@gmail.com> | 2008-12-04 14:33:18 -0500 |
commit | 0fe5e50be0deb6790dc6789a027c821ea8eb6a81 (patch) | |
tree | 017f55c8c2d7fce68c36e49205b8c6901f123d3e /util/sock.h | |
parent | 30573a6d913eb33db89ccafd6e1dbb34e901583d (diff) | |
download | mongo-0fe5e50be0deb6790dc6789a027c821ea8eb6a81.tar.gz |
web console work
Diffstat (limited to 'util/sock.h')
-rw-r--r-- | util/sock.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/util/sock.h b/util/sock.h index f2be1b0f636..4f678098aec 100644 --- a/util/sock.h +++ b/util/sock.h @@ -190,3 +190,15 @@ inline SockAddr::SockAddr(const char *ip, int port) { sa.sin_addr.s_addr = inet_addr(ip); addressSize = sizeof(sa); } + +inline string getHostName() { + char buf[256]; + int ec = gethostname(buf, 127); + if( ec || *buf == 0 ) { + log() << "can't get this server's hostname errno:" << ec << endl; + return ""; + } + return buf; +} + + |