GNOME Bugzilla – Bug 707042
udpsrc binds to INADDR_ANY instead of multicast group address
Last modified: 2013-09-18 16:49:21 UTC
udpsrc binds to INADDR_ANY instead of binding to the multicast group address as is the correct behaviour on Linux.
Binding to INADDR_ANY makes it impossible to join two groups on the same machine, receiving data on the same port, as the Linux kernel will not discriminate packets based on multicast group joined.
Caveat: The Windows IP stack does not allow binding to a multicast group address but does discriminate packets based on group address when joined to a multicast group.
gst-launch-1.0 udpsrc uri=udp://18.104.22.168:1234
And in another terminal:
$ lsof | grep 1234
gst-launc 13774 medizza 5u IPv4 4586602 0t0 UDP *:1234
udpsrc0:s 13774 13775 medizza 5u IPv4 4586602 0t0 UDP *:1234
gmain 13774 13776 medizza 5u IPv4 4586602 0t0 UDP *:1234
While compared to another application that has the correct behaviour:
$ lsof | grep 5500
recordmca 13897 medizza 3u IPv4 4587787 0t0 UDP 22.214.171.124:1234
You can't bind on a multicast address on Windows. Would it help you if we kept bind-address separate and always bind to the bind address for multicast? And for non-multicast always bind to the receiver address and ignore bind-address?
That would certainly work, although it requires a linux user to know about the behaviour of the linux ip stack if using more than one multicast group at the same time.
Author: Sebastian Dröge <email@example.com>
Date: Tue Sep 3 11:23:24 2013 +0200
udpsrc: Bind to multicast addresses on non-Windows systems
On Windows it's not possible to bind to a multicast address
but the OS will make sure to filter out all packets that
arrive not for the multicast address the socket joined.
On Linux and others it is necessary to bind to a multicast
address to let the OS filter out all packets that are received
on the same port but for different addresses than the multicast
And deprecate the multicast-group property and replace it with the