Using ListenConfig is the way to go. The Control func is passed the raw socket connection on which you can apply whatever socket options you choose. You have to go through 2 layers to get to the fd.
ListenConfig{ Control: func(conn syscall.RawConn) error { return conn.Control(func(fd uintptr) error { return syscall.SetsockoptInt(fd, syscall.AF_INET, 0, 0) }) } } On Thursday, 21 March 2019 20:49:20 UTC+5:30, Peter Wang wrote: > > I try to use net.ListenConfig, but fail > can someone give example ? > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.