From: Jonathan Wills Date: Mon, 30 Nov 2009 20:03:55 +0000 (-0800) Subject: Added a method on UDPConn so they can actually send broadcast packets. X-Git-Tag: weekly.2009-12-07~104 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=229807c8c3698c225a3fbcf594a40054e01c7758;p=gostls13.git Added a method on UDPConn so they can actually send broadcast packets. R=rsc https://golang.org/cl/162046 --- diff --git a/src/pkg/net/udpsock.go b/src/pkg/net/udpsock.go index a7069fec4b..a8b8ba3c92 100644 --- a/src/pkg/net/udpsock.go +++ b/src/pkg/net/udpsock.go @@ -71,7 +71,11 @@ type UDPConn struct { fd *netFD; } -func newUDPConn(fd *netFD) *UDPConn { return &UDPConn{fd} } +func newUDPConn(fd *netFD) *UDPConn { + c := &UDPConn{fd}; + setsockoptInt(fd.fd, syscall.SOL_SOCKET, syscall.SO_BROADCAST, 1); + return c; +} func (c *UDPConn) ok() bool { return c != nil && c.fd != nil }