Exemple #1
0
        public void CreateListener(Dictionary <String, X509Certificate2> prefixes)
        {
            var certProc = new CertificateProcessor(ServerComms);

            _listener = new System.Net.HttpListener();


            foreach (string s in prefixes.Keys)
            {
                certProc.AddCertificateToHost(s, prefixes[s]);
                _listener.Prefixes.Add(s);
            }
            _listener.Start();

            var result = _listener.BeginGetContext(new AsyncCallback(ListenerCallback), _listener);
        }
Exemple #2
0
        public void CreateListener(Dictionary <String, X509Certificate2> prefixes)
        {
            var certProc = new CertificateProcessor(ServerComms);

            _listener = new System.Net.HttpListener();


            foreach (string s in prefixes.Keys)
            {
                certProc.AddCertificateToHost(s, prefixes[s]);
                _listener.Prefixes.Add(s);
            }
            _listener.Start();

            System.Threading.Tasks.Task.Factory.StartNew(() => {
                while (_listener.IsListening)
                {
                    var result = _listener.BeginGetContext(new AsyncCallback(ListenerCallback), _listener);
                    result.AsyncWaitHandle.WaitOne();
                }
            });
        }