 
 #include <libwebsockets.h>
 
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <string.h>
+#include <sys/time.h>
+#include <assert.h>
+
+
+#include <syslog.h>
+
+
+#include <signal.h>
+
 
 #define N_PANNEL 3
 IPAddress ip[N_PANNEL]; 
-//pthread_mutex_t mutex[N_PANNEL];
-//pthread_mutex_t color_mutex;
 EthernetUDP udp[N_PANNEL];
 
 int udpPort=3333;


		gettimeofday(&tv, NULL);

		/*
		 * This provokes the LWS_CALLBACK_SERVER_WRITEABLE for every
		 * live websocket connection using the DUMB_INCREMENT protocol,
		 * as soon as it can take more packets (usually immediately)
		 */

		if (((unsigned int)tv.tv_usec - oldus) > 50000) {
			libwebsocket_callback_on_writable_all_protocol(&protocols[PROTOCOL_DUMB_INCREMENT]);
			oldus = tv.tv_usec;

		}


		/*
		 * If libwebsockets sockets are all we care about,
		 * you can use this api which takes care of the poll()
		 * and looping through finding who needed service.
		 *
		 * If no socket needs service, it'll return anyway after
		 * the number of ms in the second argument.
		 */

		n = libwebsocket_service(context, 50);

                loop(); // call loop as we have took over the execution flow :[


	}



	libwebsocket_context_destroy(context);

	lwsl_notice("libwebsockets-test-server exited cleanly\n");

	closelog();


	return 0;
}


           }
           if (pch) pannel = atoi(pch);
          

          
          if ((pannel >=0) && (pannel < N_PANNEL))
          {
