On 09/12/2009 19:38, Jay Sprenkle wrote:
On Tue, Dec 8, 2009 at 8:03 AM, Axel
mailto:axel.boost@laposte.net> wrote: When I don't read the data sent by the server, I manage to close the socket and repeat the operation (close the socket, and reconnect to the server). When I read the data, the program seems to block.
I'm new to this too but I'll suggest some things.
Is response_ an iostream? If so it might be that the read() operation is trying to read from the socket associated with the iostream and not the socket you've connected to the server.
response_ is a boost::asio::streambuf variable. I dont really understand your answer, but there is only one socket_ variable. I create a socket, connect to the server, send some bytes, read some bytes, close the socket and repeat the whole process. It blocks at the second async_read_until() , though I closed the socket and consumed the streambuf variable. Examples dont help me, no one try to repeat such a process. The problem is in the way I handle the streambuf. If I don't read the result from the streambuf, the behaviour is OK, when I try to read the streambuf, it fails.