internal static void ProcessRequest() { while (DataForWrappers.ServerWorkingFlag) { RequestHolder request; while (!DataForWrappers.Requests.TryDequeue(out request)) { Thread.Sleep(10); } request = new RequestHolder(new IPEndPoint(((IPEndPoint)request.Client).Address, DataForWrappers.SenderPort), request.Request); Dictionary <string, MyDelegate> commands = new Dictionary <string, MyDelegate> { { "SignIn", SignIn }, { "ChangePassword", ChangePassword }, { "GetShopLot", GetShopLot }, { "GetShopLotsList", GetShopLotsList }, //{"GetShopLots", GetShopLots }, { "Refill", Refill }, { "Buy", Buy } }; string tCommand = DataForWrappers.Encoding.GetString(request.Request); request.Command = tCommand.Split(); if (commands.ContainsKey(request.Command[0])) // processing command[0] { commands[request.Command[0]](request); } else { Server.Send(request.Client, new byte[] { 0 }); } } }