> > I did it in the past by creating a go routine and channel
I am thinking to do something similar too. My concern is: if given the
Reader and Writer interface have under the hood same socket file
descriptor, is it safe to call Read(), Write() in parallel from
different go routines? ( E.g what if the read system call detects the
error while the write system call blocks in separate thread? does the
write system call ever exit?, if not then the writer thread will be
deadlocked.).
Seems that Read() and Write() interfaces are implemented so that they
can be used in such scenario. They just read, write as many bytes as
possible but there's no mention in the documentation that they can be
safely called in parallel.