Boost logo

Boost Users :

Subject: [Boost-users] asio nntp reading data
From: Kraus Philipp (philipp.kraus_at_[hidden])
Date: 2010-10-24 05:46:40


Hello,

I try to read the newsgroup list with aiso, but I've got some problems
with terminate the reading. I send the "list" command to my nntp
server and get a status 200, after that I read the data with
boost::asio::streambuf l_response;
std::istream l_response_stream( &l_response );

boost::system::error_code error;
while (boost::asio::read(m_socket, l_response,
boost::asio::transfer_at_least(1), error))
        std::cout << &l_response;

and I see on cout the list (excerpt):
xs4all.ipv6 0000000481 0000000001 y
de.comp.lang.vbclassic 0000000257 0000000001 y
de.comp.office-pakete.ms-office.word 0000000013 0000000001 y
it.comp.dotnet 0000000074 0000000001 y
free.timothy.sutter 0000000003 0000000001 y
free.soc.religion.christian 0000000006 0000000001 y
free.fan.taylor-momsen 0000000000 0000000001 y
.

After the dot, my program doesn't terminate, because the while loop
doesn't break. I understand the loop in that way: I read some bytes
into my stream from the socket and write them to the std::cout, if
there more bytes the loop will continue otherwise (like EOF) the look
should be break. I use the example at http://www.boost.org/doc/libs/1_44_0/doc/html/boost_asio/example/http/client/sync_client.cpp
  because I'm new on asio, so I hope someone can explain me, the
problem.

Thanks for help

Phil
.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net