1
0
mirror of https://github.com/golang/go synced 2024-11-12 06:30:21 -07:00

Added a method on UDPConn so they can actually send broadcast packets.

R=rsc
https://golang.org/cl/162046
This commit is contained in:
Jonathan Wills 2009-11-30 12:03:55 -08:00 committed by Russ Cox
parent a85c258e67
commit 229807c8c3

View 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 }