Multicast with more NICs

Hello, I have an application which sends and receives multicast messages. It works fine, but now I have to change it to support more network interfaces. From one interface I will get response, from others not, but I don't know in general which one is the right one.

I tried it with creating a vector with multicastsockets for all (real) nics and iterate through the vector. In the part where I am waiting via socket.receive in a loop for every socket I have the problem, that receive blocks (maybe on the wrong socket) and so I don' t wait on the right socket. Therefore I thought, that making a separate thread for every socket with a separate receive method could solve my problem, but this is more work to do for me.

Is there an easy way to send and receive multicast messages via more nics? Especially waiting via socket.receive at the same time for all nics and react if data arrives through one of the nics?

Thanks for answers

[959 byte] By [manfy74a] at [2007-11-27 7:43:44]
# 1
(a) Don't bind the socket to a specific NIC. Then it is bound to the 'wildcard address' and will receive from any NIC.(b) when you join a multicast group, this is where you loop over all NICs (NetworkInterfaces), joining the group via each interface.
ejpa at 2007-7-12 19:24:27 > top of Java-index,Core,Core APIs...