简体   繁体   English

UDP数据包,包括标头

[英]UDP Packet including header

I have made simple UDP Client / Server application. 我已经做了简单的UDP Client / Server应用程序。 The client send server a text message. 客户端向服务器发送文本消息。 All works fine. 一切正常。 My question is: when I open Wireshark, i see that total length of the packet is bigger then I see it in code and I assume that this is because of the header that being append to the data. 我的问题是:当我打开Wireshark时,我看到数据包的总长度更大,然后我在代码中看到了它,我认为这是因为标头附加到了数据上。 Is there any way to get the full packet (header + payload) on server side? 有什么办法可以在服务器端获取完整的数据包(标头+有效负载)? I seen multiple threads on winpcap but it's not what I'm looking for. 我在winpcap上看到多个线程,但这不是我想要的。 I need UDP listener that will receive data with header as byte array. 我需要UDP侦听器,它将以标头作为字节数组接收数据。

You cannot do this with native .Net. 您不能使用本机.Net执行此操作。 Reading / writing raw frames is the job of the network stack, not the application. 读取/写入原始帧是网络堆栈的工作,而不是应用程序的工作。 Are you sure you really need to do this? 您确定您确实需要这样做吗?

If you really must, you will have to use a winpcap wrapper such as Pcap.Net . 如果确实需要,则必须使用Winpcap包装器,例如Pcap.Net

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM