Exemple #1
0
        static void handleRequestEnter(InputPacket ip, User u)
        {
            Console.WriteLine("handlerE");
            OutputPacket op1 = new OutputPacket(512, Protocol.RESPONSE_ENTER);

            u.setUserName(ip.readBytes());
            op1.writeUser(u);

            op1.writeInt32(usrList.Count);

            foreach (User otherUsr in usrList)
            {
                op1.writeUser(otherUsr);
            }
            u.sendPacketAsync(op1);

            OutputPacket op2 = new OutputPacket(512, Protocol.BROADCAST_ENTER);

            op2.writeUser(u);
            foreach (User otherUsr in usrList)
            {
                otherUsr.sendPacketAsync(op2);
            }

            usrList.Add(u);
            //Console.WriteLine("HEOS");
        }