receiving multicast packets
Posted on 2006-05-16
Let's say my application wants to receive two different multicast streams. One is broadcast to 184.108.40.206:9020 and one to 220.127.116.110:9020.
I have two different sockets (on different threads) which go through the following process:
setsockopt() // to allow binding on the same port
bind() // bind to port 9020
setsockopt() // to join the multicast group for the multicast address we want to listen to
recvfrom() // call this in a loop to get our multicast packets
The problem I'm having is that each socket is receiving packets from BOTH multicast groups! Shouldn't the socket only receive packets from the multicast address that is joined to via setsockopt?
Also it should be noted that if the two multicast streams I'm receiving are on different ports, then this problem doesn't exist.