I need some help in fully understanding multicast. For an
application to receive multicast packets it first has to bind to a port
and then add membership to the multicast group. Is this right.
Here is my setup - A machine with one IP interface and one
Here is what I did -
1) Open a socket.
2) Bind the socket with address IP1, port1.
3) Set socket options to add multicast membership to multicast
The ip_mreq structure is filled as
struct ip_mreq mreq;
mreq.imr_interface.s_addr = htonl(IP1);
mreq.imr_multiaddr.s_addr = htonl(MADDR1);
4) I send a packet with the destination address as MADDR1 and
I dont get any data on this socket. If I change the address IP1
in step 2 to INADDR_ANY then I receive the packet. Why dont I receive
the packet in the first case.
My second question.
I have a machine with two IP interfaces. The two IP interfaces are
on seperate LAN's. I want to open one server per interface and listen
to multicast packets only on that interface. What is the best way to do
Sent via Deja.com http://www.deja.com/
Before you buy.