protected override void OnStop() { if (server != null) { server.Stop(); } if (consoleServer != null) { consoleServer.Stop(); } }
static void Main(string[] args) { Listener l = Listener.CreateInstance(System.Configuration.ConfigurationManager.AppSettings["listenIPAddress"], Int32.Parse(System.Configuration.ConfigurationManager.AppSettings["listenPort"]), Int32.Parse(System.Configuration.ConfigurationManager.AppSettings["bufferFlushFrequency"])); Syslog.Server.Console.Server consoleServer = new Syslog.Server.Console.Server(); if (l.Start()) { Listener.MessageReceived += new Listener.MessageReceivedEventHandler(l_MessageReceived); Console.WriteLine("Listener Started. Press any key to stop listener"); consoleServer.Start(); Console.WriteLine("Console server started."); } Console.ReadLine(); l.Stop(); consoleServer.Stop(); }