I need to listen to 2 different multicast groups using the same port. Program A
will listen from 230.0.0.1
and Program B
from 23
"connect" might be what you need after all. Typically, for connecting TCP sockets, the man page also suggests that it can be used for filtering out UDP packets from other addresses:
From the man page posted here:
If the socket sockfd is of type SOCK_DGRAM then addr is the address to which datagrams are sent by default, and the only address from which datagrams are received.