Ejemplo n.º 1
0
int main (int argc, char **argv){
	minstack_tcp *mt_listen;
	if(argc != 4)
		usage(argv[0]);

	signal(SIGABRT, stop);
	signal(SIGTERM, stop);
	signal(SIGINT, stop);

	printf("starting %s on the address %s port %d\n",argv[0],argv[1],atoi(argv[2]));
	mt_listen = minstack_tcp_init("The minstack client test");
	if(minstack_tcp_init_client(mt_listen,atoi(argv[2]),argv[1]))
	{
		printf("We could not initialized the client test...\n");
		return 0;
	}
	minstack_tcp_set_external_read_function(mt_listen,listenner);
	minstack_set_debug_level(MINSTACK_WARNING_LEVEL);
	minstack_tcp_start(mt_listen);
	usleep(100*1000);
	minstack_tcp_printf(mt_listen,"%s",argv[3]);
    usleep(2*1000*1000);
	printf("stopping %s\n",argv[0]);
	minstack_tcp_stop(mt_listen);
	minstack_tcp_uninit(mt_listen);
	return 0;
}
Ejemplo n.º 2
0
int main (int argc, char **argv){
	minstack_tcp *mt_listen;
	if(argc != 5)
		usage(argv[0]);

	signal(SIGABRT, stop);
	signal(SIGTERM, stop);
	signal(SIGINT, stop);

	printf("Starting %s\n",argv[0]);
	printf("We are saying to %s to send videosupervision to %s:%d\n", argv[1],argv[2],atoi(argv[3]));
	mt_listen = minstack_tcp_init("The minstack client test");
	if(minstack_tcp_init_client(mt_listen,listenning_port,argv[1]))
	{
		printf("We could not initialized the client test...\n");
		return 0;
	}
	minstack_tcp_set_external_read_function(mt_listen,listenner);
	minstack_set_debug_level(MINSTACK_WARNING_LEVEL);
	minstack_tcp_start(mt_listen);
	usleep(100*1000);
    send_options(mt_listen,USER_AGENT_TAG,argv[1]);
    usleep(100*1000);
    send_describe(mt_listen,USER_AGENT_TAG,argv[1]);
    usleep(100*1000);
    if(!strcmp(argv[4],"play"))
    {
        send_play(mt_listen,USER_AGENT_TAG,argv[1],argv[2],atoi(argv[3]),"H264");
        printf("Should be playing Here !!!\n");
    }
    else
    {
        send_teardown(mt_listen,USER_AGENT_TAG,argv[1]);
        printf("Should be stopping Here !!!\n");
    }
    usleep(10*1000);
	printf("stopping %s\n",argv[0]);
	minstack_tcp_uninit(mt_listen);
	return 0;
}
Ejemplo n.º 3
0
/**
 * \brief The simplest way to start a client
 * \param nickname is the name given to the minstack_tcp could be NULL
 * \param port is the port where the client has to connect
 * \param address is the IP address where the client has to be connected
 * \return the minstack_tcp stack generated, NULL if something wrong happenned
 */
minstack_tcp *minstack_tcp_start_a_client(const char *nickname, int port,
        const char *address) {
    int retval;
    minstack_tcp *mt = minstack_tcp_init(nickname);
    if (mt == NULL)
    {
        printerror("Cannot init a minstack TCP\n");
        return NULL;
    }
    retval = minstack_tcp_init_client(mt, port, address);
    if (retval) {
        printerror("Cannot init TCP client\n");
        minstack_tcp_uninit(mt);
        return NULL;
    }
    retval = minstack_tcp_start(mt);
    if (retval) {
        printerror("Cannot start TCP client\n");
        minstack_tcp_uninit(mt);
        return NULL;
    }
    return mt;
}