示例#1
0
        public void Start()
        {
            // Create the listener
            var listener = new TcpListener(IPAddress.Any, Port);

            listener.Start();

            try
            {
                while (true)
                {
                    // Accept the Tcp connection from the clients
                    var client = listener.AcceptTcpClient();

                    Trace.TraceInformation("Connection from {0}", client.Client.RemoteEndPoint);

                    // The Handler should take care of the work from now
                    var handler = new SslHandler(client, Certificate);
                    var thread = new Thread(handler.Handle);
                    handlers.Add(thread);
                    thread.Start();
                }
            }
            catch (ThreadAbortException tae)
            {
                handlers.ForEach(x => x.Abort());
            }
        }
示例#2
0
        public void Start()
        {
            // Create the listener
            var listener = new TcpListener(IPAddress.Any, Port);

            listener.Start();

            try
            {
                while (true)
                {
                    // Accept the Tcp connection from the clients
                    var client = listener.AcceptTcpClient();

                    Trace.TraceInformation("Connection from {0}", client.Client.RemoteEndPoint);

                    // The Handler should take care of the work from now
                    var handler = new SslHandler(client, Certificate);
                    var thread  = new Thread(handler.Handle);
                    handlers.Add(thread);
                    thread.Start();
                }
            }
            catch (ThreadAbortException tae)
            {
                handlers.ForEach(x => x.Abort());
            }
        }