How handle with "use of closed network connection"

For a http ‘listenAndServe’ and ‘listener.close’, then it will trigger listener with this err “use of closed network connection”

I linked the issue, and there are example codes. I’m not sure how to solve this err in an elegant way.
Can someone help?

your main control flow will first start the server (in separate go routine).
Then it will close the socket (calling listener.Close()) the server is serving.

look waitgroup examples how to wait for other go routines to finnish.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.