static public void ClientReceiverMethod()
        {
            NetServer MediatorServer = MediatorMain.MediatorServer;

            while (true)
            {
                NetIncomingMessage IncMsg;
                while ((IncMsg = MediatorServer.ReadMessage()) != null)
                {
                    try
                    {
                        if (IncMsg.MessageType == NetIncomingMessageType.UnconnectedData)
                        {
                            byte   Command = IncMsg.ReadByte();
                            string data    = IncMsg.ReadString();
                            new RequestBuilder(IncMsg.SenderEndPoint, Command, data);
                            if (MediatorSettings.ShowLog)
                            {
                                Log.ColorBorder("Received from: " + IncMsg.SenderEndPoint, Command.ToString() + data, ConsoleColor.Cyan);
                            }
                        }
                        MediatorServer.Recycle(IncMsg);
                    }
                    catch (Exception E)
                    {
                        Log.Error(E.Message, E.ToString());
                    }
                }
                Thread.Sleep(1);
            }
        }
Exemple #2
0
    void Update()
    {
        NetIncomingMessage IncMsg;

        while ((IncMsg = connector.client.ReadMessage()) != null)
        {
            if (IncMsg.MessageType == NetIncomingMessageType.UnconnectedData)
            {
                byte   Command = IncMsg.ReadByte();
                string data    = IncMsg.ReadString();
                if (Command == 1)
                {
                    SHOW(data);
                }
            }
            connector.client.Recycle(IncMsg);
        }
    }
Exemple #3
0
        static public void ClientReceiverMethod()
        {
            NetServer MediatorServer = MediatorMain.MediatorServer;

            while (true)
            {
                NetIncomingMessage IncMsg;
                while ((IncMsg = MediatorServer.ReadMessage()) != null)
                {
                    if (IncMsg.MessageType == NetIncomingMessageType.UnconnectedData)
                    {
                        new PackedETask(IncMsg.SenderEndPoint, IncMsg.ReadByte(), IncMsg.ReadString());
                        Console.WriteLine("Полученны данные от клиента. Конечная точка: " + IncMsg.SenderEndPoint);
                    }
                    MediatorServer.Recycle(IncMsg);
                }
                Thread.Sleep(1);
            }
        }