The MessageReceived
event arguments provide the RemoteEndPoint
property that can be used to retrieve the remove machine's IP address and port:
// create a server instance
var server = new SyslogServer();
// bind endpoints
server.Bind(SyslogServer.DefaultPort, SyslogTransportProtocol.Udp);
server.Bind(SyslogServer.DefaultPort, SyslogTransportProtocol.Tcp);
// register an event handler for received messages
server.MessageReceived += (s, e) =>
{
Console.WriteLine("Message from {0}: {1}", e.RemoteEndPoint.Address, e.Message.Text);
};