From: michael Date: Sat, 1 Jul 2006 18:30:17 +0000 (+0000) Subject: add SO_REUSEADDR X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/record-dvb/commitdiff_plain/d11994716b3355a3687a1be6d4ad939724e56dff?hp=cc319f8b578acbc41ef1282c064a8041b196d0ee add SO_REUSEADDR --- 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;