CFLAGS =-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -Wall -g
 
-OBJS = record-dvb.o http.o mcast.o common.o
+COMMONOBJS = http.o mcast.o common.o
+OBJS = record-dvb.o dump-mcast.o $(COMMONOBJS)
 
-all: record-dvb
+all: record-dvb dump-mcast
 
 DEPEND=$(OBJS:.o=.d)
 -include $(DEPEND)
 
-record-dvb: $(OBJS)
+record-dvb: record-dvb.o $(COMMONOBJS)
+
+dump-mcast: dump-mcast.o $(COMMONOBJS)
 
 clean:
        rm -f record-dvb $(OBJS) $(DEPEND)
 
--- /dev/null
+#include <features.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <time.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <strings.h>
+
+#include "mcast.h"
+
+#define CHUNKSIZE 1500
+
+int main(int argc, char **argv)
+{
+       char *url;
+       int bytes, written, i;
+       int in;
+       char buffer[CHUNKSIZE];
+
+       if (argc == 2) {
+               url = argv[1];
+       } else {
+               fprintf(stderr,"Syntax: %s URL\n", argv[0]);
+               exit(EXIT_FAILURE);
+       }
+
+       if ((in = open_mcast(url)) < 0) {
+               fprintf(stderr,"Can't open url %s!\n",url);
+               exit(EXIT_FAILURE);
+       }
+
+       while(1) {
+               if ((bytes = recv(in, buffer, CHUNKSIZE, 0)) < 1) {
+                       perror("recv");
+                       exit(EXIT_FAILURE);
+               }
+
+               written = 0;
+               do {
+                       if ((i = write(STDOUT_FILENO, buffer, bytes-written)) < 0) {
+                               perror("write");
+                               exit(EXIT_FAILURE);
+                       }
+                       written += i;
+               } while(written < bytes);
+       }
+
+       close(in);
+
+       return EXIT_SUCCESS;
+}