Subject: Re: More sockets and link-local multicast questions
To: Andrew White <awhite@arc.corp.mot.com>
From: Nick Amato <naamato@nexthop.com>
List: tech-net
Date: 10/11/2001 12:27:56
On Thu, Oct 11, 2001 at 12:48:46PM +1000, Andrew White wrote:
> Nick Amato wrote:
>
> > Shouldn't you be using:
> >
> > setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP,
> > &mreq, sizeof(mreq));
> >
> > after using bind(2) to attach to port 9001?
>
> Yep. That (deep down) is how I implement this step:
> >> Socket sock_en0 joins mcast group 224.0.0.127 on en0. sock_en1 does
> >> the same on en1.
>
> It works as expected for a single socket joining a group on one or more
> interfaces. The quirk is that if two different sockets join the same group
> on two different interfaces, they BOTH get the packets from either
> interface. Which leads me to suspect a feature, but I can't tell whether it
> is in the implementation or my understanding.
I may be wrong, but you seem to be binding to 224.0.0.127:9001 instead
of simply port 9001, which is what you want.
Nick