Source file
src/net/sockopt_solaris.go
1
2
3
4
5 package net
6
7 import (
8 "os"
9 "syscall"
10 )
11
12 func setDefaultSockopts(s, family, sotype int, ipv6only bool) error {
13 if family == syscall.AF_INET6 && sotype != syscall.SOCK_RAW {
14
15
16
17 syscall.SetsockoptInt(s, syscall.IPPROTO_IPV6, syscall.IPV6_V6ONLY, boolint(ipv6only))
18 }
19 if (sotype == syscall.SOCK_DGRAM || sotype == syscall.SOCK_RAW) && family != syscall.AF_UNIX {
20
21 return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_BROADCAST, 1))
22 }
23 return nil
24 }
25
26 func setDefaultListenerSockopts(s int) error {
27
28 return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1))
29 }
30
31 func setDefaultMulticastSockopts(s int) error {
32
33
34 return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1))
35 }
36
View as plain text