-
Dave Cheney authored
notes: Darwin is very particular about joining a multicast group if the listneing socket is not created in "udp4" mode, the other supported OS's are more flexible. A simple example sets up a socket to listen on the mdns/bonjour group 224.0.0.251:5353 // ensure the sock is udp4, and the IP is a 4 byte IPv4 socket, err := net.ListenUDP("udp4", &net.UDPAddr { IP: net.IPv4zero, // currently darwin will not allow you to bind to // a port if it is already bound to another process Port: 5353, }) if err != nil { log.Exitf("listen %s", err) } defer socket.Close() err = socket.JoinGroup(net.IPv4(224, 0, 0, 251)) if err != nil { log.Exitf("join group %s", err) } R=adg, rsc CC=golang-dev https://golang.org/cl/4066044
0856731d