#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
#include "dmsd.h"
/* pid's */
int vpid,apid;
/* ip */
- sockaddr_in dbox_addr;
+ struct sockaddr_in dbox_addr;
+ /* some ints */
+ int status,recvd_bytes;
if(argc!=4) {
printf("usage: %s <video pid> <audio pid> <dbox ip address>\n",argv[1]);
return -1;
}
- sscanf(argv[2],"%x",vpid);
- sscanf(argv[3],"%x",apid);
+ //sscanf(argv[1],"%x",vpid);
+ vpid=atoi(argv[1]);
+ //sscanf(argv[2],"%x",apid);
+ apid=atoi(argv[2]);
+
printf("using video pid %x & audio pid %x ...\n",vpid,apid);
if((v_fd=socket(AF_INET,SOCK_STREAM,0)) == -1) {
memset(&dbox_addr,0,sizeof(dbox_addr));
dbox_addr.sin_family=AF_INET;
- target_addr.sin_port=htons(DBOX2_TS_PORT));
- target_addr.sin_addr.s_addr=inet_addr(argv[4]);
+ dbox_addr.sin_port=htons(DBOX2_TS_PORT);
+ dbox_addr.sin_addr.s_addr=inet_addr(argv[3]);
if(connect(v_fd,(struct sockaddr *)&dbox_addr,sizeof(dbox_addr))==-1) {
+ printf("unable to connect. (video pid)\n");
+ perror("connect");
+ exit(1);
+ }
+
+ dprintf(v_fd,"GET /%x HTTP/1.0\r\n\r\n",vpid);
+ status=1;
+ while(status) {
+ unsigned char buf[BUFFER_LENGTH];
+
+ status=recv(v_fd,buf,sizeof(buf),0);
+ write(1,buf,status);
+ }
+
+ return 0;
}