Boost logo

Boost Users :

Subject: [Boost-users] tcp::acceptor works differently on windows than linux.
From: Michael Dehmlow (dehmlowm_at_[hidden])
Date: 2009-03-05 19:07:15


I'm writting a multiplatform app which uses a tcp::acceptor.
Thread one does:
                {
                    std::cout<<"Oh but I interupted: "<<std::endl;
                    _myTCPAcceptor->close();
                    std::cout<<"Done interupting "<<std::endl;
                }
                std::cout<<"About to join "<<std::endl;
                _myAcceptorThread->join();
                std::cout<<"Join complete"<<std::endl;
Thread two does:

{
            boost::system::error_code ec;
            boost::asio::socket_base::non_blocking_io command(false);
            _mySocket.io_control(command,ec);

            boost::system::error_code ec1;
            std::cout<<"About to accept "<<std::endl;
            _myTCPAcceptor->accept(_mySocket,ec1);
            std::cout<<boost::system::system_error(ec1).what()<<std::endl;
            std::cout<<"done with the accept"<<std::endl;
}

Output is:
Linux Redhat:
                About to accept

                Oh but I interupted:
                Done interupting
                About to join
                ... blocks forever
Windows XP:

                About to accept

                Oh but I interupted:
                Done interupting
                About to join
                A blocking operation was interrupted by a call to
WSACancelBlockingCall
                done with the accept
                Join complete
on windows xp pro the call populates error code with:
A blocking operation was interrupted by a call to WSACancelBlockingCall

Any solutions other wise I gotta go to pocking the acceptor with another
socket connection :(.

-- 
View this message in context: http://www.nabble.com/tcp%3A%3Aacceptor-works-differently-on-windows-than-linux.-tp22363691p22363691.html
Sent from the Boost - Users mailing list archive at Nabble.com.

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