Пример #1
0
        public void AcceptConnection()
        {
            if (listener.Pending())
            {
                var socket   = listener.AcceptSocket();
                var greetMsg = new ServerPacket(0x7E);
                var client   = new Client(socket, this);

                var ip = ((IPEndPoint)socket.RemoteEndPoint).Address.ToString();

                if (Program.IPBanList.Contains(ip))
                {
                    client.Connected = false;
                    return;
                }

                Clients.Add(client);
                greetMsg.WriteByte(0x1B);
                greetMsg.WriteString("CONNECTED SERVER\n");
                client.Enqueue(greetMsg);
            }
        }