On Sat, Feb 17, 2024 at 10:23:40AM -0800, binbinschen00 wrote: > If I want to bind the socket fd to another interface for the same http > server (meaning same address:port), do I need to close/shutdown the > existing server first and start a new one? Is there a way to just modify > the socket bind without close/shutdown the socket?
Turns out you can apparently do it post bind, just played around with it. Question is, should you? It smells like an XY problem to me. What are you actually trying to do? But sure, just use the same pattern with the syscall con in whatever logic you use to switch. `listener.(*net.TCPListener).SyscallConn()` will give you the interface needed to do so. -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/cjtttlaqz24bcv5s4iigwsx4snt2l3sarp5f672yngw2e65kn5%40z4s3ddyj3mu5.