Looks like a TCP proxy or forwarder to me. For full duplex communicating
you need two go routines per connection/session. And yes, needs something
like a wait group for synchronization in order to handle half- closed
connections properly, for client and server variants.
On Sunday, August 21, 2
"conn" is just a value, you can pass it around. However, if you're sharing
it between multiple goroutines you need to be careful, i.e. you need to
synchronize properly. The synchronization solutions are very specific to
your application: e.g. you could wait for that goroutine to finish with a
My original issue is when using splice with io.Copy (example below), for
me to regain access to conn, In a different go routine, I use
remote.Close() which ends the one of io.Copy commands but, the second
io.Copy ends when conn sends a new packet. The error use of closed network
connection en
do you even need a multiplexer? The common patten is to run Accept in a
loop that simply starts a new Go routine for every new accepted connection.
You only need a multiplexer of your application protocol needs multiplexing
inside an established TCP connection, either because there are multiple