I'm building an application that creates a multicast socket
MulticastSocket mcDataListener = new MulticastSocket(8004);
and then joins a few multicast groups on the same interface.
mcDataListener.joinGroup(mcsocketAddr, listNetIntfc);
For example, it joins 225.1.1.1 and 225.1.1.2 on the same listNetIntfc.
The application works fine receiving multicast packets addressed to these two MC groups.
The problem I am having is that I can't find a way to identify to which MC group the DatagramPacket received belongs.
The DatagramPacket.getData() method returns the data following the IP Header (20 bytes) and the UDP Header (8 bytes).
The Destination Address with the multicast address is in the IP Header section of the packet, which is not available from the
DatagramPacket.
Appreciate any suggestion of how to resolve this problem.