예제 #1
0
        public static void Handle(ClientSocket clientSocket, byte[] packet)
        {
            NetworkMonitor.Log(BitConverter.ToInt32(packet, 0), TrafficMode.In);
            var packetId = (PacketType)packet[5];
            var user     = (User)clientSocket.StateObject;

            switch (packetId)
            {
            case PacketType.MsgHandshake:
                MsgDiffieHandler.Process(clientSocket, packet);
                break;

            case PacketType.MsgLogin:
                MsgLoginHandler.Process(clientSocket, packet);
                break;

            case PacketType.MsgFile:
                MsgFileHandler.Process(user, packet);
                break;

            case PacketType.MsgToken:
                MsgTokenHandler.Process(user, packet);
                break;

            case PacketType.MsgBench:
                MsgBenchHandler.Process(clientSocket, packet);
                break;

            default:
                Console.WriteLine("Unknown Packet Id " + packetId);
                break;
            }
        }
예제 #2
0
 public void Send(byte[] packet)
 {
     NetworkMonitor.Log(BitConverter.ToInt32(packet, 0), TrafficMode.Out);
     Socket?.Send(packet);
 }