0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 00:56:44 +01:00

make binding to an address work SERVER-220

This commit is contained in:
Eliot Horowitz 2009-08-10 10:37:56 -04:00
parent 71aa2443a3
commit 7cadc27b27

View File

@ -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);
}