[FFmpeg-devel] UDP multicasts mixed up on receive due to wrong bind()

Laurent laurent.aml
Wed Oct 15 02:35:49 CEST 2008


On 10/14/08, Luca Abeni <lucabe72 at email.it> wrote:
> Hi Laurent,
> Laurent wrote:
> > Hi,
> >
> > Basically, using the same socket port for 2 applications is not a good
> > idea, as the port is what identifies the application within a host.
> > This would be obvious if you try to do the same test with unicast
> > instead of multicast.
> Well, I believe that the application is identified by the
> (destination address, port) pair. So, in the unicast case using the
> same port for different streams does not make sense (but I've seen
> things like this in the past...), but in the multicast case it can
> make sense. If the two streams are generated by different nodes,
> they might have no way to know if a port is already used by someone
> else (on a different multicast group).

Yes. This is true for port, and this is true for multicast addresses too.
Basically, when using multicast, you need to rely on a mutlicast+port
allocation policy. This policy allows you to ensure that a multicast
group is used only once, and the same for the port. The problem is
even more complex on the port side, as you have to ensure that the
port you use is free on all your receivers.

> BTW, when a host has multiple unicast addresses, different applications
> can receive different streams on the same port, if they are directed
> to different destination addresses.
> > Nevertheless, the demultiplexing of UDP packets to sockets is done
> > using the port, and also the destination address (the multicast
> > address, for instance). Thanks to that, binding to the multicast
> > address solves the current problem, on Linux, at least.
> Uhm... So, there is no standard way for an application to say
> "I want to receive data from port P on multicast group MC", or
> things like this?

None that I am aware of.



More information about the ffmpeg-devel mailing list