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 126.96.36.199 port 1234,
>> but just call it 188.8.131.52.1234. Then you can tell at a glance that
>> it will result in a different socket than 184.108.40.206.1234 (i.e. address
>> 220.127.116.11 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 18.104.22.168 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.
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