public MyNLogDevicesAppServer(myNLogClientAppServer @ClientAppServer) : base(new DefaultReceiveFilterFactory <MyReceiveFilter, MyRequestInfo>()) { ClientAppServer = @ClientAppServer; NewRequestReceived += ProcessNewMessage; DefaultResponse = ASCIIEncoding.ASCII.GetBytes("SN?\r\n"); dict.TryAdd("1", new NLogdevice() { SN = "1", lastComm = DateTime.Now }); //dict.TryAdd("2", new NLogdevice() //{ // SN = "2", // lastComm = DateTime.Now //}); thread = new Thread(new ThreadStart(MsgGuard)); thread.Start(); thread = new Thread(new ThreadStart(MsgGuard1)); thread.Name = "MsgGuard1"; thread.Start(); }
public void Setup() { //SecureTestServer.config ICertificateConfig certificate = new CertificateConfig() { FilePath = @"c:\Projects\EYDAP\Code\SuperSocket-1.6\supersocket.pfx", Password = "******", ClientCertificateRequired = false, }; m_Config = new ServerConfig { Port = 555, Ip = "Any", MaxConnectionNumber = 10000, Mode = SocketMode.Tcp, Name = "NLogDevices", MaxRequestLength = 50000, //Certificate=certificate, //Security="tls" }; m_ConfigNLogClient = new ServerConfig { Port = 8200, Ip = "Any", MaxConnectionNumber = 10, Mode = SocketMode.Tcp, Name = "NLogClient", MaxRequestLength = 50000 //Certificate=certificate, //Security="tls" }; NLogDevicesServer = new MyNLogDevicesAppServer(NLogClientServer); NLogDevicesServer.Setup(new RootConfig(), m_Config, logFactory: new ConsoleLogFactory()); NLogClientServer = new myNLogClientAppServer(NLogDevicesServer); NLogClientServer.Setup(new RootConfig(), m_ConfigNLogClient, logFactory: new ConsoleLogFactory()); NLogDevicesServer.ClientAppServer = NLogClientServer; Global.serversDic.TryAdd(NLogDevicesServer.Name, NLogDevicesServer); Global.serversDic.TryAdd(NLogClientServer.Name, NLogDevicesServer); }