ASIO sockets and stream buffers
I'm having trouble with trying to connect my TCP sockets up to a stream buffer, and need some help. I've already opened my sending socket, or accepted a connection to get a new receiving socket, and I want to send messages back and forth. What I'd like to write is something like: void sendMessage(boost::asio::ip::tcp::socket* s) { ?? some stream type ?? str(s); str << ... write stuff ... << flush(); str >> ... read stuff ...; } I can't seem to find the right stream type that takes my existing socket. Does such a creature exist in the ASIO library? Help! Thanks in advance, Jeff Diewald JEOL USA
Hi,
I can't seem to find the right stream type that takes my existing socket. Does such a creature exist in the ASIO library?
This is what I do: boost::asio::streambuf request; std::ostream requestStream(&request); requestStream << myMessage; // Send the request. boost::asio::write(socket, request); Regards, Roland
participants (2)
-
Jeff Diewald
-
Roland Bock