Exemple #1
0
 private void OnReceive(SocketRead read, byte[] data)
 {
     try
     {
         var socketHandle = read.Socket.Handle.ToInt64();
         var c            = ResourcesManager.GetClient(socketHandle);
         c.DataStream.AddRange(data);
         Message p;
         while (c.TryGetPacket(out p))
         {
             PacketManager.ProcessIncomingPacket(p);
         }
     }
     catch (Exception ex)
     {
         Debugger.WriteLine("Error when receiving packet from client : ", ex, 4, ConsoleColor.Red);
     }
 }
Exemple #2
0
        private static void OnReceive(SocketRead read, byte[] data)
        {
            try
            {
                var socketHandle = read.Socket.Handle.ToInt64();
                var c            = ResourcesManager.GetClient(socketHandle);
                c.DataStream.AddRange(data);

                Message p;
                while (c.TryGetPacket(out p))
                {
                    PacketManager.ProcessIncomingPacket(p);
                }
            }
            catch (Exception ex)
            {
                Debugger.WriteLine("[UCR]   Exception thrown when processing incoming packet : ", ex);
            }
        }
Exemple #3
0
        void OnReceive(SocketRead read, byte[] data)
        {
            try
            {
                long   socketHandle = read.Socket.Handle.ToInt64();
                Client c            = ResourcesManager.GetClient(socketHandle);
                //Ajoute les données au stream client
                c.DataStream.AddRange(data);

                Message p;
                while (c.TryGetPacket(out p))
                {
                    PacketManager.ProcessIncomingPacket(p);
                }
            }
            catch (Exception)
            {
                //Client may not exist anymore
            }
        }