[go-nuts] Re: Go multiplexers

2022-08-21 Thread TheDiveO
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,

[go-nuts] Re: Go multiplexers

2022-08-21 Thread Brian Candler
"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

[go-nuts] Re: Go multiplexers

2022-08-21 Thread ramki...@hotmail.com
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

[go-nuts] Re: Go multiplexers

2022-08-21 Thread TheDiveO
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