title: simultaneously read and write on the same socket in C or C++
body: <p>I am implementing a simple server, that accepts a single connection and then uses that socket to simultaneously read and write messages from the read and write threads.
  What is the safe and easy way to simultaneously read and write from the same socket descriptor in c/c++ on linux?
  I dont need to worry about multiple threads read and writing from the same socket as there will be a single dedicated read and single dedicated write thread writing to the socket.</p>
  
  <p>In the above scenario, is any kind of locking required?</p>
  
  <p>Does the above scenario require non blocking socket?</p>
  
  <p>Is there any opensource library, that would help in the above scenario?</p>