如何使用以太网拖车发送数据报?
如何使用以太网拖车发送数据报?如果我使用 SocketType.Raw,我将必须发送整个 IP 标头,但我不知道该怎么做。
How can I send a datagram with an Ethernet trailer? If I use SocketType.Raw, I'll have to send the whole IP header and I have no idea how to do that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许是这样的?
这应该会给出一个原始数据包,您可以在wireshark上看到它。如果您想要 ip eader,或者将其设为 udp 或类似的东西,您可以使用此方法并自己构建标头(查看 rfc 很简单,或者只需使用wireshark 查看一堆其他数据包标头) 。请注意,对于 udp,您不必计算校验和 0x0000 是应该传递的有效校验和。
如果您想要的只是一个末尾带有零的 udp 数据包,该数据包有点相同,可能更容易,请告诉我。
Something like this perhaps?
That should give a raw packet that you can see on wireshark. if you want to have the ip eader, or make it a udp or something like that you can use this method and build the header yourself (it is trivial look at the rfcs or just use wireshark to look at a bunch of other packet headers). Note that for udp you do not have to compute a checksum 0x0000 is a valid checksum that is supposed to pass on through.
If all you want is a udp packet with zeros at the end that is somewhat the same, probably easier, let me know.
该尾部用于将以太网帧填充到其最小长度(46 字节的有效负载)。因此发送一个小的 UDP 数据包 - 小于 18 字节(因为 IP + UDP 通常为 28 字节)
That trailer is used to pad ethernet frames to their minimum length (46 bytes of payload). So send a small UDP packet - smaller than 18 bytes (as IP + UDP is normally 28 bytes)