---
title: "W7500(P) Get destination IP of received UDP packet"
url: "https://maker.wiznet.io/forum/12027"
markdown_url: "https://maker.wiznet.io/forum/12027/md"
type: "Forum topic"
category: "MCU & Boards"
author: "robalflex"
created: "2016-11-18T14:02:39+09:00"
last_activity: "2017-05-04T08:39:37+09:00"
language: "en"
views: 807
replies: 1
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# W7500(P) Get destination IP of received UDP packet

## Question

Asked by robalflex on 2016-11-18 in MCU & Boards.

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

## Replies

### Reply 1 by Kei, 2017-01-13

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\]](http://wizwiki.net/wiki/lib/exe/fetch.php?media=products:w7500:w7500_rm_v106.pdf%5B/url%5D)
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.

---

Source: https://maker.wiznet.io/forum/12027
