W7500(P) Get destination IP of received UDP packet

Hi all,

When receiving an UDP message with the recvfrom() method, the IP and port of the sender are obtained through the 8 byte header (IP sender, port sender and msg length). Now I want to know the desination IP from the IPV4 header of the packet, is this possible? I need to detect if the UDP message was a broadcast message (IP 255.255.255.255) or an unicast message.

Thanks in advance!

Rob

Hi, Rob.

As you already know, the UDP Header itself does not have an IP address. The IP Header has that information.

Since the W7500 chip uses the H / W TOE, this information is handled at the H / W level.
Among them, it uploads information that user often needs.
But, Destination ip address information of received UDP packet is not provided.

However, there is a way to distinguish.
On the W7500, you can block Unicast, BroadCast, and Multicast through the socket settings.

Refer to below link.(datasheet)
[url]http://wizwiki.net/wiki/lib/exe/fetch.php?media=products:w7500:w7500_rm_v106.pdf[/url]
To do this, refer to the Sn_MR Register in the Datasheet, pages 59-61.

In other words, you only need to open two sockets and only non-blocking Unicast and Broadcast respectively.
If you do so, you can only receive unicast packets for A sockets and broadcast packets for B sockets, so you can see what kind of cast the received packet is.

I hope this helps.

Best Regard,
Kei.