15 lines
494 B
Go
15 lines
494 B
Go
//go:build windows
|
|
|
|
package udp
|
|
|
|
import "golang.org/x/sys/windows"
|
|
|
|
// setSocketReuse enables SO_REUSEADDR on the socket before bind so that
|
|
// multiple processes (HamLog + Log4OM + …) can listen on the same UDP
|
|
// multicast port. Without it, Windows fails the second bind with
|
|
// WSAEADDRINUSE ("Une seule utilisation de chaque adresse de socket…").
|
|
func setSocketReuse(fd uintptr) error {
|
|
return windows.SetsockoptInt(windows.Handle(fd),
|
|
windows.SOL_SOCKET, windows.SO_REUSEADDR, 1)
|
|
}
|