有没有办法获得额外的数据,能够获得Buffer和RemoteEndPoint

时间:2017-11-30 11:31:21

标签: c# udp reactive

使用反应式扩展,我可以从中获取Buffer和RemoteEndPoint 在“System.Net.Sockets”下的“UdpReceiveResult”类中构建。

 public static IObservable<UdpReceiveResult> UdpStream(IPEndPoint endpoint)
    {
        return Observable.Using(() => new UdpClient(endpoint),
            udpClient => Observable.Defer(() =>
                udpClient.ReceiveAsync().ToObservable()).Repeat());
    }

 var stream = UdpStream(new IPEndPoint(IPAddress.Any, 514));
        stream.Subscribe(e => Console.WriteLine(Encoding.ASCII.GetString(e.Buffer)));

我需要根据“Facility”,“Priority”,“Time”过滤UDP数据,还需要为下面的日志获取这些数据,如“Visual Syslog Server”所示,

enter image description here

我看到“UdpReceiveResult”类只提供了2个属性,

enter image description here

问题: - 1.有没有办法为UDP消息获取“设施”等其他数据? 2.如果没有,是否有任何开源库来支持这个?

谢谢!

0 个答案:

没有答案