summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/UdpTransceiver.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2007-05-29 13:03:00 +0000
committerBenoit Foucher <benoit@zeroc.com>2007-05-29 13:03:00 +0000
commit21447f3a0f099622a45d34e37a5dbe761a0ca64c (patch)
tree7dedce7e4abebe7f616d8efcd0125afd58e8daaa /cpp/src/Ice/UdpTransceiver.cpp
parentFixed bug 2213 (diff)
downloadice-21447f3a0f099622a45d34e37a5dbe761a0ca64c.tar.bz2
ice-21447f3a0f099622a45d34e37a5dbe761a0ca64c.tar.xz
ice-21447f3a0f099622a45d34e37a5dbe761a0ca64c.zip
Moved setting of SO_REUSEADDR and added comment
Diffstat (limited to 'cpp/src/Ice/UdpTransceiver.cpp')
-rw-r--r--cpp/src/Ice/UdpTransceiver.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp
index 67e2b33bc78..1fa3fb8e5eb 100644
--- a/cpp/src/Ice/UdpTransceiver.cpp
+++ b/cpp/src/Ice/UdpTransceiver.cpp
@@ -474,6 +474,21 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s
}
else
{
+#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
doBind(_fd, _addr);
}