$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-users] async accept asio thread error
From: Gianni Ambrosio (gianni.ambrosio_at_[hidden])
Date: 2011-04-05 09:20:06
Hi All,
I'm implementing a tcp socket to be used with a client and server 
derived classes. I'm testing the code with boost test but I get the 
following error:
"The I/O operation has been aborted because of either a thread exit or 
an application request"
Here is the test code.
    std::string host = "localhost";
    unsigned short port = 20001;
    //Server* server = new Server();
    //server->acceptAsyncOnThread(port);
    Server server;
    server.acceptAsyncOnThread(port);
    Client client;
    TcpSessionPtr connection = client.connect(host, port);
    bool accepted = false;
    boost::timer timer;
    while (!accepted && timer.elapsed() < 1.0)
    {
       //accepted = server->hasAccepted();
       accepted = server.hasAccepted();
    }
    //delete server;
    BOOST_CHECK_EQUAL( accepted, true );
Can anybody please explain me the reason of that error? Moreover, do you 
expect that using the commented code (i.e. the Server instance is 
created on the heap and deleted before the BOOST_CHECK_EQUAL call) may 
solve the problem? Why?
Regards
Gianni