protected override void ProcessData(byte[] data, System.Net.EndPoint sender) { SyslogProtocol protocol = new SyslogProtocol(); protocol.SetBytes(data); if (SyslogMessageReceived != null) { SyslogMessageReceived(sender, new GenericEventArgs <SyslogProtocol>(protocol)); } }
protected override void ProcessData(byte[] data, TcpConnectionHandler sender) { SyslogProtocol protocol = new SyslogProtocol(); protocol.SetBytes(data); if (SyslogMessageReceived != null) { SyslogMessageReceived(sender, new EventArguments.GenericEventArgs <SyslogProtocol>(protocol)); } }
static void Main(string[] args) { SyslogProtocol protocol = new SyslogProtocol(); protocol.Header.Appname = "SyslogTest"; protocol.Header.Facility = SyslogFacility.Local0; protocol.Header.Hostname = "127.0.0.1"; protocol.Header.Severity = SyslogSeverity.Debug; protocol.Message = "Hallo! dies ist eine Testnachricht"; protocol.Header.Timestamp = DateTime.Now; protocol.Header.Version = 1; protocol.Header.MsgID = "ID22"; protocol.Header.ProcID = "Proc99"; SyslogProtocol settedProtocol = new SyslogProtocol(); settedProtocol.SetBytes(protocol.GetBytes()); Console.WriteLine("Original: " + protocol.ToString()); Console.WriteLine("Setted: " + settedProtocol.ToString()); Console.Read(); }