Re: multicast: same port, different IP address?
From: Matt Garman
Date: Wed Apr 08 2009 - 17:09:02 EST
On Wed, Apr 8, 2009 at 2:51 PM, David Stevens <dlstevens@xxxxxxxxxx> wrote:
> Matt Garman <matthew.garman@xxxxxxxxx> wrote on 04/08/2009 11:43:48 AM:
>
>> Is it a dangerous oversimplification to think of the port as simply an
>> extension of the address? E.g., you have address 239.0.0.1 port 1234,
>> but just call it 239.0.0.1.1234. Then you can tell at a glance that
>> it will result in a different socket than 239.0.0.2.1234 (i.e. address
>> 239.0.0.2 port 1234). [I'm not suggesting using this nomenclature, it
>> just seems like an intuitive way to think about/explain it.]
>
> That is correct.
I just did a test, and don't understand the results.
I wrote two simple programs, one each for sending and receiving
multicast data. I'm running all programs on the same machine:
I start the sender program, sending on address 239.1.1.100 port 10000.
I start the receiver program using the same address+port as the
sender. I see data.
I kill then restart the receiver program using a different address,
same port: no data.
I kill then restart the receiver program using the same address,
different port: no data.
I start a receiver with a different port, same address: no data. I
leave that receiver running, and start a second receiver with the same
address+port as the sender: I get data. The first receiver still
doesn't see any data.
So far so good, exactly what I expected. But now it gets weird:
I start a receiver with the same port, but a different IP. No data.
I leave that receiver running, and start a second with the same
address+port as the sender: I get data on this program, *and start
getting data on the first program*. If I kill the second receiver, I
stop getting data on the original receiver.
Any thoughts?
Thanks,
Matt
--
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