diff options
Diffstat (limited to 'tcpreceive.c')
-rw-r--r-- | tcpreceive.c | 13 |
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; |