aboutsummaryrefslogtreecommitdiff
path: root/tcpreceive.c
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2010-10-11 16:04:04 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2010-10-11 16:04:04 +0000
commit123856cdff90e5a2b41fff1df198f73a1f37792f (patch)
treebe2220996b192154ebc1a3d4cad5ec07da415de9 /tcpreceive.c
parentb151462a3d83ec23f531579d69bad299045d64d4 (diff)
use SO_REUSEPORT (if available during compile-time)
svn path=/trunk/externals/iem/iemnet/; revision=14222
Diffstat (limited to 'tcpreceive.c')
-rw-r--r--tcpreceive.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/tcpreceive.c b/tcpreceive.c
index 56d758c..d008108 100644
--- a/tcpreceive.c
+++ b/tcpreceive.c
@@ -235,11 +235,22 @@ static void tcpreceive_port(t_tcpreceive*x, t_floatarg fportno)
}
/* ask OS to allow another Pd to reopen this port after we close it. */
+#ifdef SO_REUSEADDR
intarg = 1;
if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR,
(char *)&intarg, sizeof(intarg))
- < 0)
+ < 0) {
error("[%s]: setsockopt (SO_REUSEADDR) failed", objName);
+ }
+#endif /* SO_REUSEADDR */
+#ifdef SO_REUSEPORT
+ intarg = 1;
+ if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEPORT,
+ (char *)&intarg, sizeof(intarg))
+ < 0) {
+ error("[%s]: setsockopt (SO_REUSEPORT) failed", objName);
+ }
+#endif /* SO_REUSEPORT */
/* Stream (TCP) sockets are set NODELAY */
intarg = 1;