Example #1
0
 public SecureChannel(Server server, string token,
                      NotifyReceiveComplete completeEvent, NotifyErrorReceiving errorEvent)
 {
     if (certificate == null)
     {
         System.Console.WriteLine(Directory.GetCurrentDirectory());
         certificate = new X509Certificate2("Certificates\\certificate.pfx", "malnati");
     }
     this.token    = token;
     this.server   = server;
     this.listener = new TcpListener(IPAddress.Any,
                                     UsefullMethods.GetAvailablePort(30000));
     this.thread          = new Thread(this.ThreadCode);
     this.errorEvent      = errorEvent;
     this.completeEvent   = completeEvent;
     this.start           = new AutoResetEvent(false);
     this.clientConnected = new AutoResetEvent(false);
     this.thread.Start();
 }