Re: multicast: same port, different IP address?
From: David Stevens
Date: Wed Apr 08 2009 - 14:12:58 EST
linux-net-owner@xxxxxxxxxxxxxxx wrote on 04/08/2009 09:42:58 AM:
> I don't really understand what the concept of a port is in Linux with
> regards to multicast.
> Basically, I want to use multicast on an internal network with many
> nodes. I want to use multicast IP addresses to delineate the message
> *type*. E.g., 220.127.116.11 for status monitoring, 18.104.22.168 for control
> messages, 22.214.171.124 for heartbeats, 126.96.36.199 for chatting, etc etc.
> Since I'm using the address space to delineate messages, can I just
> hard-code my port (i.e. make it always the same)?
> Put another way: what is the effect of having one host subscribe to
> multiple multicast streams, where each stream has the same port, but a
> different ip address? Is there a performance impact?
If any process joins a group, those will be delivered
to any matching binds. It doesn't matter whether or not your
process did the join.
You can bind to the particular multicast address and you'll
receive only that group on that socket. For your traffic, it doesn't
matter whether they are different ports or not in that case,
since both the port and the address must match.
So, if you bind the different sockets using the multicast
addresses and the same port, you should get the effect you're
after, just as you would if you used INADDR_ANY and different
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html