In my application I have one MulticastSocket that joins 40 multicast IP addresses (On the same port).
When receiving a datagram, is there a way to find the specific Multicast IP that a it was sent to ?
The same question about the new "DatagramChannel" (in Java 7), that also support multicasting.
Thank you very much !
In Java 1 through 6 you must create one socket per IP multicast address and then use private data to help determine the incoming address.
In the host CRT you can use
IP_PKTINFO and the
CMSG_* apis to determine the destination address but these have not been exposed in Java.
Java 7 brings NIO support for multicast along with SSM (RFC3768).