Multicast Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nuno Magalhaes

    #1

    Multicast Question

    I'm streaming quicktime H264 movies to 224.1.2.3:554. Why, in my
    MulticastReceiv er 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 MulticastReceiv er(string remoteIPAddress ,int remotePort)
    {
    //Create multicast receiver socket
    socket=new
    Socket(AddressF amily.InterNetw ork,SocketType. Dgram,ProtocolT ype.Udp);
    IPEndPoint ep=new IPEndPoint(IPAd dress.Any,remot ePort);
    socket.Bind(ep) ;
    IPAddress ip=IPAddress.Pa rse(remoteIPAdd ress);
    socket.SetSocke tOption(SocketO ptionLevel.IP,S ocketOptionName .AddMembership, new
    MulticastOption (ip,IPAddress.A ny));
    }

  • Jon Skeet [C# MVP]

    #2
    Re: Multicast Question

    Nuno Magalhaes wrote:[color=blue]
    > I'm streaming quicktime H264 movies to 224.1.2.3:554. Why, in my
    > MulticastReceiv er 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.[/color]

    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

    Comment

    • Nuno Magalhaes

      #3
      Re: Multicast Question

      But it's not at my IP address it's from 10.154.0.104:60 00 to
      224.1.2.3:554.[color=blue]
      >From another application on another computer, I can only receive the[/color]
      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.

      Comment

      • Nuno Magalhaes

        #4
        Re: Multicast Question

        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.

        Comment

        • Jon Skeet [C# MVP]

          #5
          Re: Multicast Question

          Nuno Magalhaes wrote:[color=blue]
          > 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.[/color]

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

          Jon

          Comment

          • Nuno Magalhaes

            #6
            Re: Multicast Question

            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.

            Comment

            • Jon Skeet [C# MVP]

              #7
              Re: Multicast Question

              Nuno Magalhaes wrote:[color=blue]
              > I've tested my NetworkEmulator application (that works like a router)
              > and the only way to work is this:[/color]

              <snip>
              [color=blue]
              > 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.[/color]

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

              Jon

              Comment

              • Nuno Magalhaes

                #8
                Re: Multicast Question

                Not for now :-)

                Comment

                Working...