Permalink
Browse files

make binding to an address work SERVER-220

  • Loading branch information...
1 parent 71aa244 commit 7cadc27b27580c8eeafc8300bd37140d3943f281 @erh erh committed Aug 10, 2009
Showing with 3 additions and 2 deletions.
  1. +3 −2 util/sock.h
View
@@ -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);
}

0 comments on commit 7cadc27

Please sign in to comment.