如何在 Windows 上获取syscall.Handlea的底层?*net.UDPConn我想要这个句柄来设置IP_MULTICAST_TTLvia syscall.SetsockoptInt。在 Linux 上,我执行以下操作:
func setTTL(conn *net.UDPConn, ttl int) error {
f, err := conn.File()
if err != nil {
return err
}
defer f.Close()
fd := int(f.Fd())
return syscall.SetsockoptInt(fd, syscall.SOL_IP, syscall.IP_MULTICAST_TTL, ttl)
}
但在 Windows 上,隐式insidedup失败:*net.UDPConnFile()
04:24:49 main.go:150: dup: windows 不支持
并在源代码中标记为待办事项。我怎样才能得到这个手柄?如果没有,还有其他方法可以设置 TTL 吗?
更新0
我已将缺点提交给 Go 问题跟踪器: