From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,f75b1bb7f6564b55,start X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2003-04-24 18:51:01 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: dhalser@yahoo.com (wrapper) Newsgroups: comp.unix.tru64 Subject: binding to a multicast address with multiple listeners Date: 24 Apr 2003 18:51:01 -0700 Organization: http://groups.google.com/ Message-ID: NNTP-Posting-Host: 64.178.96.44 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1051235461 17223 127.0.0.1 (25 Apr 2003 01:51:01 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 25 Apr 2003 01:51:01 GMT Xref: archiver1.google.com comp.unix.tru64:9839 I do not have a copy of Stevens' Network Programming Book, but I am nonetheless curious about why binding to a multicast address is a bad idea. I have the situation in my multicast application whereby multiple sockets are bound to the same multicast port (say 8000) with INADDR_ANY for the bind() address parameter. The sockets then each join a different multicast group. However, all the sockets receive any multicast traffic aimed at that port, even multicast traffic for an address that was not the multicast group the socket joined. As I understand, joining the multicast group only tells the IP layer to accept network traffic for a certain multicast address. It does not tell the UDP layer to deliver that data to the appropriate socket. Therefore, it would seem bind is the way in which the operating system filters the multicast data so it knows what socket to deliver the data to. Without a multicast bind it seems there is no way to have multiple sockets listen to the same port for different destination addresses at the same time. (Putting multicast data on the same port is done because of network configuration reasons where my application is to be used. A router bridges two networks and only allows multicast data through on a certain port.) So why is a multicast bind a bad idea? It seems to be the only way to discriminate traffic sent to the port. In theory it seems possible that any unicast data aimed at the port could be picked up by a socket bound with INADDR_ANY so there would even be more potential for confusion as far as the socket is concerned. What am I missing?