If you are running Ubuntu 12.04.4 LTS, you may be surprised that you cannot receive multicast packets in your programs using the normal socket interface, but then you run tcpdump and can receive the multicast packets just fine. You also might be surprised that you can send multicast packets just fine from your programs, but cannot receive them.
It turns out that you need to do this (as root):
echo 2 > /proc/sys/net/ipv4/conf/eth0/rp_filter
On every interface you wish to receive multicast packets on.
If you want the changes to rp_filter to be permanent, you need to add the changes to /etc/sysctl.conf and you may also want to tweak /etc/sysctl.d/10-network-security.conf
A great way to test the reception of multicast packets is "mcfirst", part of the ssmping package ("apt-get install sampling" to install). mcfirst will let you listen to any group,port on any network interface.
"netstat -gn" will show you which multicast groups your network interfaces are subscribed to.