aboutsummaryrefslogtreecommitdiff
path: root/udpreceive.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 /udpreceive.c
parentb151462a3d83ec23f531579d69bad299045d64d4 (diff)
use SO_REUSEPORT (if available during compile-time)
svn path=/trunk/externals/iem/iemnet/; revision=14222
Diffstat (limited to 'udpreceive.c')
-rw-r--r--udpreceive.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/udpreceive.c b/udpreceive.c
index 2338cec..768d42e 100644
--- a/udpreceive.c
+++ b/udpreceive.c
@@ -84,11 +84,22 @@ static void udpreceive_port(t_udpreceive*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)
+ (char *)&intarg, sizeof(intarg))
+ < 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 */
server.sin_family = AF_INET;