接收MAC ID广播UDP数据包的问题

发布于 2024-10-19 07:13:22 字数 929 浏览 6 评论 0原文

就我而言,硬件 UDP 数据包被发送到目标 PC - 192.168.13.250 (45141),但 MAC ID 为 FF:FF:FF:FF:FF:FF。现在我绑定到该目标 IP &端口不使用套接字。但我无法使用套接字程序从 PC 接收 UDP 数据包。它不是来自 recvfrom() 调用。它仍在等待。如果我使用硬件设置将 MAC ID 更改为目标 PC MAC ID(00-12-d5-f6-3e-92),那么我就能够接收 UDP 数据包。在不改变MAC ID的情况下,即如何从广播MAC ID接收UDP数据包。任何帮助将不胜感激。提前致谢。以下是来自 Wireshark 的日志。

  • 未收到以下 UDP 数据包 (Wireshark)

帧 3609(线上 7978 字节,捕获 7978 字节) 以太网 II,源:0a:dc:0a:dc:0a:dc (0a:dc:0a:dc:0a:dc),目标:广播 (ff:ff:ff:ff:ff:ff) 互联网协议,源:192.168.13.25 (192.168.13.25),目标:192.168.13.250 (192.168.13.250) 用户数据报协议,源端口:lbc-control (2780),目标端口:45141 (45141) 数据(7936 字节)

  • 接收到以下 UDP 数据包 (Wireshark)

帧 3609(线上 7978 字节,捕获 7978 字节) 以太网 II,源:0a:dc:0a:dc:0a:dc (0a:dc:0a:dc:0a:dc),目标:广播 (00:12:d5:f6:3e:92) 互联网协议,源:192.168.13.25 (192.168.13.25),目标:192.168.13.250 (192.168.13.250) 用户数据报协议,源端口:lbc-control (2780),目标端口:45141 (45141) 数据(7936 字节)

In my case, from a hardware UDP packets are sent to destination PC - 192.168.13.250 (45141) but MAC ID is FF:FF:FF:FF:FF:FF. Now I binded to that destination IP & port no using sockets. But I'm not able to receive UDP packets form PC using socket program. It is not coming out of recvfrom() call. Still it is waiting. If I change the MAC ID to destination PC MAC ID(00-12-d5-f6-3e-92) using hardware settings, then I'm able to receive UDP packets. Without changing the MAC ID, i.e, How to receive UDP packets from broadcast MAC ID. Any help would be highly appreciated. Thanks in advance. Following is the log from Wireshark.

  • With following UDP packets are not received (Wireshark)

Frame 3609 (7978 bytes on wire, 7978 bytes captured)
Ethernet II, Src: 0a:dc:0a:dc:0a:dc (0a:dc:0a:dc:0a:dc), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol, Src: 192.168.13.25 (192.168.13.25), Dst: 192.168.13.250 (192.168.13.250)
User Datagram Protocol, Src Port: lbc-control (2780), Dst Port: 45141 (45141)
Data (7936 bytes)

  • With following UDP packets are received (Wireshark)

Frame 3609 (7978 bytes on wire, 7978 bytes captured)
Ethernet II, Src: 0a:dc:0a:dc:0a:dc (0a:dc:0a:dc:0a:dc), Dst: Broadcast (00:12:d5:f6:3e:92)
Internet Protocol, Src: 192.168.13.25 (192.168.13.25), Dst: 192.168.13.250 (192.168.13.250)
User Datagram Protocol, Src Port: lbc-control (2780), Dst Port: 45141 (45141)
Data (7936 bytes)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青春有你 2024-10-26 07:13:22

RFC 1122 第 3.3.6 节规定:
“当主机向链路层广播地址发送数据报时,IP 目标地址必须是合法的 IP 广播或多播地址。”

如果您希望 PC 接收带有广播 MAC 地址的 UDP 数据包,则还应该使用广播 IP 地址。

RFC 1122 section 3.3.6 states:
"When a host sends a datagram to a link-layer broadcast address, the IP destination address MUST be a legal IP broadcast or IP multicast address."

If you want your PC to receive the UDP packet with a broadcast MAC address, you should also be using a broadcast IP address.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文