Exemplo n.º 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();
            }
        }
Exemplo n.º 2
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();
			}
		}
		public FastcgiServerClientRequestHandlerAsync(FastcgiServerClientHandlerAsync FastcgiServerClientHandlerAsync, Stream ClientStream, ushort RequestId)
		{
			this.FastcgiServerClientHandlerAsync = FastcgiServerClientHandlerAsync;
			this.ClientStream = ClientStream;
			this.RequestId = RequestId;
			this.FastcgiRequestAsync = new FastcgiRequestAsync()
			{
				StdinStream = new FastcgiInputStream(),
			};
			this.FastcgiResponseAsync = new FastcgiResponseAsync()
			{
				StdoutStream = new FastcgiOutputStream(),
				StderrStream = new FastcgiOutputStream(),
				Headers = new FastcgiHeaders(),
			};

			this.FastcgiResponseAsync.StdoutWriter = new StreamWriter(this.FastcgiResponseAsync.StdoutStream);
			this.FastcgiResponseAsync.StdoutWriter.AutoFlush = true;

			this.FastcgiResponseAsync.StderrWriter = new StreamWriter(this.FastcgiResponseAsync.StderrStream);
			this.FastcgiResponseAsync.StderrWriter.AutoFlush = true;
		}
        public FastcgiServerClientRequestHandlerAsync(FastcgiServerClientHandlerAsync FastcgiServerClientHandlerAsync, Stream ClientStream, ushort RequestId)
        {
            this.FastcgiServerClientHandlerAsync = FastcgiServerClientHandlerAsync;
            this.ClientStream        = ClientStream;
            this.RequestId           = RequestId;
            this.FastcgiRequestAsync = new FastcgiRequestAsync()
            {
                StdinStream = new FastcgiInputStream(),
            };
            this.FastcgiResponseAsync = new FastcgiResponseAsync()
            {
                StdoutStream = new FastcgiOutputStream(),
                StderrStream = new FastcgiOutputStream(),
                Headers      = new FastcgiHeaders(),
            };

            this.FastcgiResponseAsync.StdoutWriter           = new StreamWriter(this.FastcgiResponseAsync.StdoutStream);
            this.FastcgiResponseAsync.StdoutWriter.AutoFlush = true;

            this.FastcgiResponseAsync.StderrWriter           = new StreamWriter(this.FastcgiResponseAsync.StderrStream);
            this.FastcgiResponseAsync.StderrWriter.AutoFlush = true;
        }