How to get the destination address of an incoming udp dgram?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get the destination address of an incoming udp dgram?

Jump to solution
559 Views
m_bach
Contributor III

Hi Community,

I'm looking for a way to tell an incoming IPv4 UDP unicast from incoming IPv4 UDP broadcast.

I found this howto, but I canot find 'struct mh' and function recvmsg() MQX v4.1.1:

linux - Get destination address of a received UDP packet - Stack Overflow

Is there an MQX way of getting the destination address?

Please note: recvfrom() gives me the sender's address to be able to reply the datagram, what I need is the destination address.

Thanks a lot, Martin

Labels (1)
0 Kudos
1 Solution
392 Views
m_bach
Contributor III

I helped myself with creating three sockets to the same UDP port:

one for IPv4 bound to the interface IP, one IPv4 bound to INET_ANY, one last but not leas one to IPv6.

that'll do.

View solution in original post

0 Kudos
1 Reply
393 Views
m_bach
Contributor III

I helped myself with creating three sockets to the same UDP port:

one for IPv4 bound to the interface IP, one IPv4 bound to INET_ANY, one last but not leas one to IPv6.

that'll do.

0 Kudos