On Sun, Jun 21, 2020 at 8:05 PM Robert Engels <reng...@ix.netcom.com> wrote:

> Most webservers use multiple threads per socket - this is commonly
> observed with async IO. IO in Go is async behind the scenes so you don’t
> need to worry about this. You probably will use a Go routine to read the
> socket; and probably another to do the writing - so you can treat the IO as
> synchronous. That is a wonderful aspect of Go.
>

That is true but it's not clear the O.P. is ready to appreciate that
distinction. Note that their question was about having multiple readers
running in parallel. Something that, in general, is not safe for TCP
connections. It's not safe even if additional constraints, such as fixed
size structures, are in effect. That's because TCP does not preserve
message boundaries and a given structure might be broken up and received in
pieces. Thus resulting in different readers of the socket reading different
pieces of the structure.

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
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/CABx2%3DD-3U%3DA0A9%2BO7%2BCAKLUVLA0s7Gn%3DrfGfwxDhu5PHA70_Fg%40mail.gmail.com.

Reply via email to