CSharpUtils.Web._45.Fastcgi.FastcgiServerClientHandlerAsync.Handle C# (CSharp) Метод

Handle() публичный Метод

public Handle ( ) : System.Threading.Tasks.Task
Результат System.Threading.Tasks.Task
		public async Task Handle()
		{
			if (FastcgiServerAsync.Debug) await Console.Out.WriteLineAsync(String.Format("Handling Client"));
			var ClientStream = Client.GetStream();

			try
			{
				while (Client.Connected)
				{
					FastcgiPacket Packet;
					try
					{
						Packet = await new FastcgiPacket().ReadFromAsync(ClientStream);
					}
					catch (IOException)
					{
						Console.Error.WriteLineAsync("Error Reading");
						break;
					}
					FastcgiServerClientRequestHandlerAsync Handler;
					if (!this.Handlers.TryGetValue(Packet.RequestId, out Handler))
					{
						Handler = this.Handlers[Packet.RequestId] = new FastcgiServerClientRequestHandlerAsync(this, ClientStream, Packet.RequestId);
					}
					await Handler.HandlePacket(Client, Packet);
				}
			}
			catch (IOException IOException)
			{
				if (FastcgiServerAsync.Debug)
				{
					Console.Error.WriteAsync(IOException.ToString());
				}
			}
		}
	}

Usage Example

Пример #1
0
        public async Task ListenAsync(ushort Port, string Address = "0.0.0.0")
        {
            TcpListener = new TcpListener(IPAddress.Parse(Address), Port);
            TcpListener.Start();
            //if (Debug)
            {
                await Console.Out.WriteLineAsync(String.Format("Listening {0}:{1}", Address, Port));
            }

            while (true)
            {
                var FastcgiServerClientHandlerAsync = new FastcgiServerClientHandlerAsync(this, await TcpListener.AcceptTcpClientAsync());
                FastcgiServerClientHandlerAsync.Handle();
                //await FastcgiServerClientHandlerAsync.Handle();
            }
        }
All Usage Examples Of CSharpUtils.Web._45.Fastcgi.FastcgiServerClientHandlerAsync::Handle
FastcgiServerClientHandlerAsync