示例#1
0
        public bool Start(bool bgThread, int backlog)
        {
            if (started)
            {
                throw new InvalidOperationException("The server is already started.");
            }

            if (vpathToHost == null)
            {
                throw new InvalidOperationException("SetApplications must be called first.");
            }

            if (SingleApplication)
            {
                var v     = vpathToHost [0];
                v.AppHost = AppHost;
                // Link the host in the application domain with a request broker in the *same* domain
                // Not needed for SingleApplication and mod_mono
                v.RequestBroker       = webSource.CreateRequestBroker();
                AppHost.RequestBroker = v.RequestBroker;
            }

            listen_socket = webSource.CreateSocket();
            listen_socket.Listen(backlog);
            runner = new Thread(RunServer)
            {
                IsBackground = bgThread
            };
            runner.Start();
            stop = false;
            return(true);
        }
        public bool Start(bool bgThread)
        {
            if (started)
            {
                throw new InvalidOperationException("The server is already started.");
            }

            if (vpathToHost == null)
            {
                throw new InvalidOperationException("SetApplications must be called first.");
            }

            listen_socket = webSource.CreateSocket();
            listen_socket.Listen(500);
            listen_socket.Blocking = false;
            runner = new Thread(new ThreadStart(RunServer));
            runner.IsBackground = bgThread;
            runner.Start();
            stop = false;
            return(true);
        }