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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
1,105 次查看
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

标签 (1)
0 项奖励
回复
1 解答
938 次查看
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 项奖励
回复
1 回复
939 次查看
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 项奖励
回复