From 229807c8c3698c225a3fbcf594a40054e01c7758 Mon Sep 17 00:00:00 2001 From: Jonathan Wills Date: Mon, 30 Nov 2009 12:03:55 -0800 Subject: [PATCH] Added a method on UDPConn so they can actually send broadcast packets. R=rsc https://golang.org/cl/162046 --- src/pkg/net/udpsock.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 } -- 2.50.0