help_windows_test.go 227 B

123456789101112131415
  1. package door
  2. import (
  3. "net"
  4. )
  5. func socket_to_fd(socket net.Conn) int {
  6. client_conn := socket.(*net.TCPConn)
  7. raw, _ := client_conn.SyscallConn()
  8. var fd int
  9. raw.Control(func(sfd uintptr) {
  10. fd = int(sfd)
  11. })
  12. return fd
  13. }