net.ListenPacket("udp", "
224.0.0.9:520") --> works, allows multiple multicast sockets bound to 520, but socket reads from all interfaces :(
However I am still unable to restrict socket to reading from specific interface. :(
Results were:
# Binding to unicast address 1.0.0.2 of eth2 does NOT work at all:
2016/02/11 20:16:26 readLoop: reading
# Binding to 0.0.0.0 works but reads from all interfaces:
$ go run mcast_listener.go eth2 udp 224.0.0.9 :2000
2016/02/11 20:14:42 readLoop: reading
2016/02/11 20:14:54 readLoop: recv 2 bytes from 1.0.0.1 to 224.0.0.9 on eth2
$ go run mcast_listener.go lo udp 224.0.0.9 :2000
2016/02/11 20:14:48 readLoop: reading
2016/02/11 20:14:54 readLoop: recv 2 bytes from 1.0.0.1 to 224.0.0.9 on eth2
# Binding to 224.0.0.9 works but reads from all interfaces:
2016/02/11 20:17:56 readLoop: reading
2016/02/11 20:18:23 readLoop: recv 2 bytes from 1.0.0.1 to 224.0.0.9 on eth2
2016/02/11 20:18:18 readLoop: reading
2016/02/11 20:18:23 readLoop: recv 2 bytes from 1.0.0.1 to 224.0.0.9 on eth2
Any other suggestion on how to create multiple per-interface multicast listener sockets (that don't receive datagrams from other interfaces)?
Thanks,
Everton