Example #1
0
        /// <summary>
        /// Server class initialization.
        /// </summary>
        /// <exception cref="ServerInitializationException"/>
        public Server()
        {
            // Debug messages
            log.Debug("Initializing server...");

            // Debug messages
            log.Debug("Getting requested path...");
            if (ConfigurationManager.AppSettings.HasKeys())
            {
                Server.DEFAUL_TPREFIX = ConfigurationManager.AppSettings["Listener Prefix"];
            }
            else
            {
                log.Warn("Error getting app settings for listen prfixes. Using default: " + Server.DEFAUL_TPREFIX);
            }

            try
            {
                this.listeningThread = new Thread(Listen);
                this.listener        = new HttpListener();
                this.serverCore      = new ServerCore();

                this.workingThreads = 0;
                this.waitHandle     = new AutoResetEvent(false);
                this.locker         = new object();

                this.activeThreadsWaitHandle = new AutoResetEvent(false);

                // Debug messages
                log.Debug("Server initialized!");
            }
            catch (Exception e)
            {
                log.Fatal("Server class initialization failed!", e);
                throw new ServerInitializationException("Server class initialization failed", e);
            }
        }
Example #2
0
        /// <summary>
        /// Server class initialization.
        /// </summary>
        /// <exception cref="ServerInitializationException"/>        
        public Server()
        {
            // Debug messages
            log.Debug("Initializing server...");

            // Debug messages                            
            log.Debug("Getting requested path...");
            if (ConfigurationManager.AppSettings.HasKeys())
            {
                Server.DEFAUL_TPREFIX = ConfigurationManager.AppSettings["Listener Prefix"];
            }
            else 
            {
                log.Warn("Error getting app settings for listen prfixes. Using default: " + Server.DEFAUL_TPREFIX);
            }

            try
            {
                this.listeningThread = new Thread(Listen);
                this.listener = new HttpListener();
                this.serverCore = new ServerCore();

                this.workingThreads = 0;
                this.waitHandle = new AutoResetEvent(false);
                this.locker = new object();

                this.activeThreadsWaitHandle = new AutoResetEvent(false);

                // Debug messages
                log.Debug("Server initialized!");
            }
            catch (Exception e)
            {
                log.Fatal("Server class initialization failed!", e);
                throw new ServerInitializationException("Server class initialization failed", e);
            }          
        }                
Example #3
0
 public void FixtureSetup()
 {        
     this.server = new ServerCore();
 }