Consider the following:
if fd, err = syscall.Socket(family, syscall.SOCK_STREAM, syscall.IPPROTO_TCP); err != nil {
return
}
// do something on fd like bind ...
if err = os.NewSyscallError("connect", syscall.Connect(fd, sockaddr)); err != nil {
syscall.Close(fd)
return
}
f := os.NewFile(uintptr(fd), "socket")
conn, err = net.FileConn(f)
if err != nil {
fmt.Println(err)
f.Close()
syscall.Close(fd)
}
result: file file+net socket: not supported by windows
Is there any way to transfrom the syscall.Handle
to a net.Conn
on Windows ?
I use Windows 10 and go version 1.10.3 windows/amd64