2 years ago
#25128
Michael Schäfer
How can I access a running boost :: asio client and send requests to the server?
I use the code for the boost::asio SSL Server from this official example. Everything works great as long as I use it like in the example with the console input in the send_request() function. My goal is to access the running client and send queries to the server.
My first attempt was to add a public method named request() to access the clients send method from the main method. If I ran the client, it stopped immediately. I assume that this was due to the asynchronous functions (maybe the sockets are closed before the server sends the response) and the now missing recursion (I've deleted the send_request() call in the receive_response() function).
My second attempt was to create the socket in the main method and pass it as an argument in the class. This also failed.
How can I achieve the desired functionality?
EDIT: Does the client have to reconnect to the server for each query?
c++
boost
boost-asio
0 Answers
Your Answer