void EncenderServidor()
        {
            string    localComputerName = Dns.GetHostName();
            IPAddress direccion;

            NetworkInterface[] ni = NetworkInterface.GetAllNetworkInterfaces();

            direccion = ni[1].GetIPProperties().UnicastAddresses[1].Address;
            IPEndPoint ep = new IPEndPoint(direccion, DatosConfiguracion.getPuerto());

            socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            socket.Bind(ep);
            socket.Listen(10);
            tConexion = new Thread(new ThreadStart(ThreadConexion));
            tConexion.Start();
        }
        public void InitializeSockets()
        {
            _sockets = new List <IWebSocketConnection>();
            int puerto = DatosConfiguracion.getPuerto() + 1;
            var server = new WebSocketServer("ws://localhost:" + puerto);

            server.Start(socket =>
            {
                socket.OnOpen = () =>
                {
                    _sockets.Add(socket);
                };
                socket.OnClose = () =>
                {
                    _sockets.Remove(socket);
                };
                socket.OnMessage = message =>
                {
                    comprobarOrden(message);
                };
            });
        }