Esempio n. 1
0
        public async Task ListenAsync(int Port, IPAddress Address)
        {
            TcpListener = new TcpListener(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());
                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;
		}