fixed dynamic port allocation

This commit is contained in:
Matej Sekoranja
2011-03-03 13:07:28 +01:00
parent 911a1368b0
commit d8fd120578
2 changed files with 4 additions and 2 deletions

View File

@@ -66,6 +66,9 @@ namespace epics {
THROW_BASE_EXCEPTION(temp.str().c_str());
}
else {
epicsSocketEnableAddressReuseDuringTimeWaitState(_serverSocketChannel);
// try to bind
int retval = ::bind(_serverSocketChannel,
&_bindAddress.sa, sizeof(sockaddr));

View File

@@ -143,8 +143,7 @@ void ServerContextImpl::internalInitialize()
initializeBroadcastTransport();
_acceptor = new BlockingTCPAcceptor(this, _serverPort, _receiveBufferSize);
//TODO fix this
//_serverPort = _acceptor->getBindAddress()->ia.sin_port;
_serverPort = ntohs(_acceptor->getBindAddress()->ia.sin_port);
_beaconEmitter = new BeaconEmitter(_broadcastTransport, this);
}