add SO_REUSEADDR
authormichael <michael>
Sat, 1 Jul 2006 18:30:17 +0000 (18:30 +0000)
committermichael <michael>
Sat, 1 Jul 2006 18:30:17 +0000 (18:30 +0000)
mcast.c

diff --git a/mcast.c b/mcast.c
index 5f7dadc5d66bbbea98ef1a733e8695ebababb805..fc72056cb239f0e244208d054f6154fe2d5e41a5 100644 (file)
--- 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;
Impressum, Datenschutz