]> Cypherpunks repositories - gostls13.git/commitdiff
Added a method on UDPConn so they can actually send broadcast packets.
authorJonathan Wills <runningwild@gmail.com>
Mon, 30 Nov 2009 20:03:55 +0000 (12:03 -0800)
committerRuss Cox <rsc@golang.org>
Mon, 30 Nov 2009 20:03:55 +0000 (12:03 -0800)
R=rsc
https://golang.org/cl/162046

src/pkg/net/udpsock.go

index a7069fec4bd07ebaa9f575985a5b7954c0cb1e1a..a8b8ba3c922b2d0854f5e0ff76532c749f894e54 100644 (file)
@@ -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 }