diff options
author | Benoit Foucher <benoit@zeroc.com> | 2007-05-29 13:25:28 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2007-05-29 13:25:28 +0000 |
commit | e245463bb9b97d557a728316b7f4041e56c45997 (patch) | |
tree | cd7a563758f5f58646018c315f8d9dc3b1fb8932 /cppe/src/TcpTransport/Acceptor.cpp | |
parent | Set SO_REUSEADDR for server sockets. Bug 2079. (diff) | |
download | ice-e245463bb9b97d557a728316b7f4041e56c45997.tar.bz2 ice-e245463bb9b97d557a728316b7f4041e56c45997.tar.xz ice-e245463bb9b97d557a728316b7f4041e56c45997.zip |
Bug 2079
Diffstat (limited to 'cppe/src/TcpTransport/Acceptor.cpp')
-rw-r--r-- | cppe/src/TcpTransport/Acceptor.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cppe/src/TcpTransport/Acceptor.cpp b/cppe/src/TcpTransport/Acceptor.cpp index 72e53c7ace9..b32928219ec 100644 --- a/cppe/src/TcpTransport/Acceptor.cpp +++ b/cppe/src/TcpTransport/Acceptor.cpp @@ -116,6 +116,21 @@ IceInternal::Acceptor::Acceptor(const InstancePtr& instance, const string& host, _fd = createSocket(); getAddress(host, port, _addr); setTcpBufSize(_fd, _instance->initializationData().properties, _logger); +#ifndef _WIN32 + // + // Enable SO_REUSEADDR on Unix platforms to allow re-using the + // socket even if it's in the TIME_WAIT state. On Windows, + // this doesn't appear to be necessary and enabling + // SO_REUSEADDR would actually not be a good thing since it + // allows a second process to bind to an address even it's + // already bound by another process. + // + // TODO: using SO_EXCLUSIVEADDRUSE on Windows would probably + // be better but it's only supported by recent Windows + // versions (XP SP2, Windows Server 2003). + // + setReuseAddress(_fd, true); +#endif if(_traceLevels->network >= 2) { Trace out(_logger, _traceLevels->networkCat); |