Hi All
I am doing first steps with boost::asio and I want to use ip::tcp::stream to send data from a server to a client.
Reading the sample in boost docs I did a first sample of server code.

Is there any way  for the server to check if a client connection is closed or gone 
at some point?

for( ;; ){
boost::asio::ip::tcp::iostream stream;
acceptor.accept( *stream.rdbuf() ); 

for( int i = 0; i < 10; i++ ){

stream << "message" << i << std::endl;

// how to realize that the client has gone here?              

boost::this_thread::sleep( boost::posix_time::milliseconds(1000) );
}