I have two threads, one sending and another receiving data via TCP socket. I use boost::asio::read() and boost::asio::write() for reading and writ
boost::asio::read()
boost::asio::write()
The socket is not thread safe when shared between two or more threads. For more information look at the Boost.Asio documentation.