I want to use VLM via my own program.
the following codes get a error:
-------------------------------------------------------------------------
#include<stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#define SERVPORT 4212
main(int argc, char *argv[]){
int sockfd;
struct hostent *host;
struct sockaddr_in serv_addr;
char *init[]={"admin\r",
"new channel1 broadcast enabled\r",
"setup channel1 input /download/test.avi\r",
"setup channel1 output #standard{mux=ts,access=udp,url="."127.0.0.1".",sap,name=\"Channel 1\"}\r",
"control channel1 play\r"};
int t;
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1){
perror("socket error");
exit(1);
}
serv_addr.sin_family=AF_INET;
serv_addr.sin_port=htons(SERVPORT);
inet_aton("127.0.0.1",&serv_addr.sin_addr);
bzero(&(serv_addr.sin_zero),8);
if (connect(sockfd, (struct sockaddr *)&serv_addr,sizeof(struct sockaddr))==-1){perror("connect error");
exit(1);
}
for(t=0;t<5;t++)
{
send(sockfd,init[t],strlen(init[t]),0);
sleep(1);
}
close(sockfd);
}
--------------------------------------------------------------------