Re: multicast: same port, different IP address?

From: Matt Garman
Date: Wed Apr 08 2009 - 13:41:52 EST


On Wed, Apr 8, 2009 at 11:52 AM, Lawrence MacIntyre
<macintyrelp@xxxxxxxx> wrote:
> If all nodes need all of those messages, then you should probably use one
> multicast address and multiple ports.  This will reduce the routing
> overhead.  However, if different nodes need different messages, then you
> would increase the network overhead by sending all messages to all nodes.

The latter case is what we need. We are basically already using the
former, but since all messages aren't required at all sites, we're
trying to reduce network load. (We have lots of message types and
very high message volume.)

>  In that case, you should use different multicast addresses for each message
> type.  In the second case, if the packets are small, you might even eschew a
> transport protocol and simply run your protocol over IP.  It is in this case
> that a port number has no meaning, since ports are a transport protocol
> mechanism.

The "raw IP" idea certainly sounds interesting, but we already have a
decent amount of multicast infrastructure built up that we're hoping
to use without a major overhaul.

So, that leaves us with using different multicast addresses for each
message type (for now anyway). Using this method, does it matter what
port I use? Do I also need a unique port for each message type, or is
the address alone sufficient to delineate the messages?

Beej's Network Programming Guide[1] uses this analogy, "Think of the
IP address as the street address of a hotel, and the port number as
the room number." If that's exactly analogous to our situation, then
it shouldn't matter if I hardcode the port number.

Furthermore, my next question is, if I go ahead and use a fixed port
(but different multicast IP addresses), is there a performance impact?
Compared to using a different address and different ports? My
intuition says no: Linux will just create two different sockets, and
manage them as such (i.e. underlying port effectively doesn't matter).
But I don't know enough about Linux internals, and how it treats
ports to verify this.

Thanks for the quick and helpful reply!

Matt

[1] http://beej.us/guide/bgnet/
--
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