Menu

#4 Server does always listen on all ip's

open
nobody
None
5
2006-07-05
2006-07-05
David
No

From Client.cpp
...
m_listenServer->setBindHost(m_client_bind_host.c_str());
if (m_use_portrange) {
m_listenServer->StartServer(m_lower_port,
m_upper_port);
} else {
m_listenServer->StartServer();
}
...

From socket.cpp
...
void TCPServer::StartServer(unsigned short lower,
unsigned short upper) {
...
localAddr.sin_addr.s_addr = INADDR_ANY;
...

The value for the bindhost set in Client.cpp gets
overwritten by "INADDR_ANY" in socket.cpp. The server
will always listen on all interfaces and not on the
one the user specified.

I found out that removing the assignment in
socket.cpp will do the trick.

Please review.

Discussion


Log in to post a comment.