]>
git.zerfleddert.de Git - record-dvb/blob - mcast.c
5f7dadc5d66bbbea98ef1a733e8695ebababb805
6 #include <sys/socket.h>
12 int is_mcast(char *url
)
17 if (!strncasecmp("udp://",url
,6))
23 int open_mcast(char *url
)
25 static struct dvb_host
*dvbhost
= NULL
;
26 struct sockaddr_in server
;
34 dvbhost
= parse(&(url
[6]), "2000");
35 dvbhost
->socktype
= SOCK_DGRAM
;
38 if (resolve(dvbhost
, &server
) < 0) {
42 bzero(&mreq
, sizeof(mreq
));
43 mreq
.imr_multiaddr
= server
.sin_addr
;
44 mreq
.imr_interface
.s_addr
= htonl(INADDR_ANY
);
46 if ((fd
= socket(AF_INET
, SOCK_DGRAM
, IPPROTO_UDP
)) < 0) {
51 if (bind(fd
, (struct sockaddr
*)&server
, sizeof(server
)) < 0) {
56 if (setsockopt(fd
, IPPROTO_IP
, IP_ADD_MEMBERSHIP
, &mreq
, sizeof(mreq
)) < 0) {