Multicast Question

N

Nuno Magalhaes

I'm streaming quicktime H264 movies to 224.1.2.3:554. Why, in my
MulticastReceiver class of another application, have I have to bind my
socket locally on the same remote port (554) in order to receive the
multicast packets (with the primitive receive)? Why can't I bind to
another port and still receive the packets? Below is the source code
I'm using to initialize the receiver.

---------------------------------
public MulticastReceiver(string remoteIPAddress,int remotePort)
{
//Create multicast receiver socket
socket=new
Socket(AddressFamily.InterNetwork,SocketType.Dgram,ProtocolType.Udp);
IPEndPoint ep=new IPEndPoint(IPAddress.Any,remotePort);
socket.Bind(ep);
IPAddress ip=IPAddress.Parse(remoteIPAddress);
socket.SetSocketOption(SocketOptionLevel.IP,SocketOptionName.AddMembership,new
MulticastOption(ip,IPAddress.Any));
}
 
J

Jon Skeet [C# MVP]

Nuno said:
I'm streaming quicktime H264 movies to 224.1.2.3:554. Why, in my
MulticastReceiver class of another application, have I have to bind my
socket locally on the same remote port (554) in order to receive the
multicast packets (with the primitive receive)? Why can't I bind to
another port and still receive the packets? Below is the source code
I'm using to initialize the receiver.

The point of specifying the port is to effectively say what you're
interested in. There may be any number of applications spitting packets
at your IP address. If all ports saw all packets, you'd see all the
packets from all of those applications.

Jon
 
N

Nuno Magalhaes

But it's not at my IP address it's from 10.154.0.104:6000 to
224.1.2.3:554.
From another application on another computer, I can only receive the
224.1.2.3 multicast packets if I'm bind to the local port 554 on the
local IP address. That leaves no room for multiple instances of
applications running on the same machine capture the multicast packets.
 
N

Nuno Magalhaes

I'm not saying that one port should see all packets. It's a multicast
packet.
It's impossible for two applications on the same machine receive
packets from the endpoint 224.1.2.3:554 since they need to
simultaneously bind the socket on local machine port 554.
 
J

Jon Skeet [C# MVP]

Nuno said:
I'm not saying that one port should see all packets. It's a multicast
packet.
It's impossible for two applications on the same machine receive
packets from the endpoint 224.1.2.3:554 since they need to
simultaneously bind the socket on local machine port 554.

Okay, I see what you're saying. I'll see what I can find out.

Jon
 
N

Nuno Magalhaes

I've tested my NetworkEmulator application (that works like a router)
and the only way to work is this:

1) RTPServer(H264) broadcasting to 224.1.2.3:554 (local port 6000)
2) NetworkEmulator from 224.1.2.3:554 to 224.1.2.4:555 (local port
6002)
3) NetworkEmulator from 224.1.2.4:555 to 224.1.2.5:556 (local port
6001)
4) NetworkEmulator from 224.1.2.5:556 to 224.1.2.6:557 (local port
6003)

Checked ethereal all on the same machine and there were entries to all
this addresses/ports (almost 120 packets/s). We have to use always
different addresses and ports and each pair address/port can only be
used once by an application simultaneously running on the same machine.

With the limitation that the Receiver function can only be bound to
port 554, 555 or 556 in this example in order to receive those packets.
 
J

Jon Skeet [C# MVP]

Nuno said:
I've tested my NetworkEmulator application (that works like a router)
and the only way to work is this:

With the limitation that the Receiver function can only be bound to
port 554, 555 or 556 in this example in order to receive those packets.

Right. So does that mean you don't need me to do any more digging?

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top