Thanks Bjorn, I have solved the problem by making a shared pointer inside tcp_connection class **boost::shared_ptr<std::string> messageSend;** . While the server now works fine, but for the client created by me, the client received gets correct response the first time but it will not get response afterwards and gives error **system:10053 receive: An established connection was aborted by the software in your host machine**
The client will attempt to connect to socket and kept on loop forever to communicate with client. Doesn't the boost keep reference of current alive connection? Please correct me.
Thanks.