Reputation: 57
I'm having trouble sending more than one request to my server.
I'm using the boost asio async_client exemple
The problem is that I always get: Error Asio.misc 2 (eof reached I think).
I don't know if the good way to do this is to have a pool of threads or if I can reuse the same io_service, ...
I don't find good answers on how to do that on the web.
I only try to send another request after I have reach the EOF from the first one.
Upvotes: 2
Views: 1088
Reputation: 4386
The client
class in the exemple wraps the whole process:
Once you reached EOF
when reading the response, your connection is closed by the server (because of the HTTP Header). Therefor, you have to restart part of the process. You have to first re-establish a connection to the remote server, send your request, and read the response. It's probably not useful to redo name resolution.
If you really want to go the simple way, then creating a new client
would probably work.
You don't need a pool of thread and you can certainly re-use your io_service
object.
Upvotes: 1