示例#1
0
        public bool Start(string hostAddress = null, int hostPort = 0)
        {
            if (hostPort == 0)
            {
                hostPort = Network.GetFreeTcpPort();
            }

            BaseUrl = "http://"
                      + (hostAddress ?? "127.0.0.1")
                      + ":" + hostPort;

            _server             = new SimpleHttpServer(hostPort);
            _server.HandleGet  += ServerOnHandleGet;
            _server.HandlePost += ServerOnHandlePost;

            _server.Start();
            return(true);
        }
        private const int MaxPostSize = 10 * 1024 * 1024; // 10MB

        public SimpleHttpProcessor(TcpClient clientSocket, SimpleHttpServer httpServer)
        {
            _socket = clientSocket;
            _server = httpServer;
        }
示例#3
0
        private const int MaxPostSize = 10 * 1024 * 1024; // 10MB

        public SimpleHttpProcessor(ILogger logger, TcpClient clientSocket, SimpleHttpServer httpServer)
        {
            _logger = logger;
            _socket = clientSocket;
            _server = httpServer;
        }