public static void Main(string[] args)
        {
            Console.Title = "*** TCP ChatRoom ***";
            Console.WriteLine("Starting Server on: " + Packet.GetIPAddress());

            listenerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            clients        = new List <ClientData>();

            IPEndPoint IP_End = new IPEndPoint(IPAddress.Parse(Packet.GetIPAddress()), 4242);

            listenerSocket.Bind(IP_End);

            Thread listenThread = new Thread(ListenThread);

            listenThread.Start();

            Console.WriteLine("Success! \nListening IP: " + Packet.GetIPAddress());
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Iniciando el server en: " + Packet.GetIPAddress());//Muestra la direccion en que se va a empezar la conexion

            //Crea el nuevo socket que va a estar escuchando los mensajes de los clientes.
            listenerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            _clients    = new List <ClientData>();
            listaEspera = new ColeccionJugador(4); //4 Jugadores en espera

            mesa = new Mesa();                     // la mesa por defecto se crea para 4 jugadores

            IPEndPoint ip = new IPEndPoint(IPAddress.Parse(Packet.GetIPAddress()), 4242);

            listenerSocket.Bind(ip);

            //Crear el thread listener
            Thread listenThread = new Thread(ListenThread);

            listenThread.Start();
        }