diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-08-10 10:37:56 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-08-10 10:37:56 -0400 |
commit | 7cadc27b27580c8eeafc8300bd37140d3943f281 (patch) | |
tree | 96ebc6581e69862572ab315e024aa929dc1346f1 | |
parent | 71aa2443a3618253422171769113b04ef5b65bd2 (diff) | |
download | mongo-7cadc27b27580c8eeafc8300bd37140d3943f281.tar.gz |
make binding to an address work SERVER-220
-rw-r--r-- | util/sock.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/util/sock.h b/util/sock.h index 4a2a3194b40..ba7b6200172 100644 --- a/util/sock.h +++ b/util/sock.h @@ -220,11 +220,12 @@ namespace mongo { addressSize = sizeof(sa); } - inline SockAddr::SockAddr(const char *ip, int port) { + inline SockAddr::SockAddr(const char * iporhost , int port) { + string ip = hostbyname( iporhost ); memset(sa.sin_zero, 0, sizeof(sa.sin_zero)); sa.sin_family = AF_INET; sa.sin_port = htons(port); - sa.sin_addr.s_addr = inet_addr(ip); + sa.sin_addr.s_addr = inet_addr(ip.c_str()); addressSize = sizeof(sa); } |