예제 #1
0
        public void ProcessNextRequest()
        {
            _clientStream = _serverConnection.GetStream();
            RequestMessageBase request = ReceiveRequest();

            switch (request.MessageType)
            {
            case PeachFarmerProtocol.ReadRequest:
            {
                Console.WriteLine("ReadRequest from client at {0}", DateTime.Now);
                ResponseMessageBase response = _readRequestProcessor.Process(request);
                Console.WriteLine("Sending response...");
                SendResponse(response);
                Console.WriteLine("Done!");
                break;
            }

            default:
                throw new ArgumentException(string.Format("Unrecognized request type: 0x{0:X2}", request.MessageType));
            }
        }