示例#1
0
        /// <summary>
        /// Start listening on a specific port.
        /// </summary>
        /// <param name="port">The port.</param>
        public void Start(int port)
        {
            if (!listener.IsListening)
            {
                listener.Prefixes.Add(String.Format(@"http://*:{0}/", port));
                listener.Start();

                // Reset events
                stop.Reset();
                ready.Reset();

                // Threads
                listenerThread = new Thread(HandleRequest);
                workerThread   = new Thread(Worker);

                listenerThread.Start();
                workerThread.Start();
            }
            else
            {
                if (Config.DebugLog != (int)DebugState.None)
                {
                    VDebug.LogWarningFormat("[Volplane (Web Listener)] WebListener already running on port: {0}.", port);
                }
            }
        }