public void Start(string hostAddress, DEAElement config, IDeaClient deaClientInstance)
        {
            Logger.Info("Starting directory server on interface '{0}:{1}'.", hostAddress, config.DirectoryServer.V2Port);

            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            this.deaClient        = deaClientInstance;
            this.streamingTimeout = config.DirectoryServer.StreamingTimeoutMS;

            this.listener.Start();
            this.listener.Prefixes.Add(string.Format(CultureInfo.InvariantCulture, "http://{0}:{1}/", hostAddress, config.DirectoryServer.V2Port));

            ThreadStart listenerThreadStart = new ThreadStart(
                () =>
            {
                while (this.listener.IsListening)
                {
                    try
                    {
                        Logger.Debug("Directory server waiting for a request ...");
                        HttpListenerContext request = this.listener.GetContext();

                        Logger.Debug("Directory server got a request, '{0}'", request.Request.Url);
                        ThreadPool.QueueUserWorkItem(ServeHttp, request);
                    }
                    catch (Exception ex)
                    {
                        Logger.Error(Strings.HttpListenerError, ex.ToString());
                    }
                }
            });

            Thread listenerThread = new Thread(listenerThreadStart);

            listenerThread.IsBackground = true;
            listenerThread.Name         = "DEA Directory Server Thread";

            listenerThread.Start();
        }
        public void Start(string hostAddress, DEAElement config, IDeaClient deaClientInstance)
        {
            Logger.Info("Starting directory server on interface '{0}:{1}'.", hostAddress, config.DirectoryServer.V2Port);

            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            this.deaClient = deaClientInstance;
            this.streamingTimeout = config.DirectoryServer.StreamingTimeoutMS;

            this.listener.Start();
            this.listener.Prefixes.Add(string.Format(CultureInfo.InvariantCulture, "http://{0}:{1}/", hostAddress, config.DirectoryServer.V2Port));

            ThreadStart listenerThreadStart = new ThreadStart(
                () =>
                {
                    while (this.listener.IsListening)
                    {
                        try
                        {
                            Logger.Debug("Directory server waiting for a request ...");
                            HttpListenerContext request = this.listener.GetContext();

                            Logger.Debug("Directory server got a request, '{0}'", request.Request.Url);
                            ThreadPool.QueueUserWorkItem(ServeHttp, request);
                        }
                        catch (Exception ex)
                        {
                            Logger.Error(Strings.HttpListenerError, ex.ToString());
                        }
                    }
                });

            Thread listenerThread = new Thread(listenerThreadStart);
            listenerThread.IsBackground = true;
            listenerThread.Name = "DEA Directory Server Thread";

            listenerThread.Start();
        }