From d11994716b3355a3687a1be6d4ad939724e56dff Mon Sep 17 00:00:00 2001 From: michael Date: Sat, 1 Jul 2006 18:30:17 +0000 Subject: [PATCH 1/1] add SO_REUSEADDR --- mcast.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mcast.c b/mcast.c index 5f7dadc..fc72056 100644 --- a/mcast.c +++ b/mcast.c @@ -25,6 +25,7 @@ int open_mcast(char *url) static struct dvb_host *dvbhost = NULL; struct sockaddr_in server; struct ip_mreq mreq; + int val; int fd; if(!is_mcast(url)) @@ -48,6 +49,12 @@ int open_mcast(char *url) return -1; } + val = 1; + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) < 0) { + perror("setsockopt"); + return -1; + } + if (bind(fd, (struct sockaddr*)&server, sizeof(server)) < 0) { perror("bind"); return -1; -- 2.39.5