Example #1
0
void TCPServer::CallBack_Accept(TCPConnection::Pointer conn, const boost::system::error_code &ec)
{
    if ( ! ec)
    {
        Logger::GetLogger()->Debug("Client Connected");

        //set nodelay option
        boost::asio::ip::tcp::no_delay  nodelay(true);
        conn->socket().set_option(nodelay);

        Server::GetInstance()->RunTask(boost::bind(&TCPConnection::Start,conn));
    }
    StartListen();
}
Example #2
0
void TCPServer::CallBack_Accept(TCPConnection::Pointer conn, const boost::system::error_code &ec)
{
    if ( ! ec)
    {
        Logger::GetLogger()->Debug("Client Connected");
        boost::asio::ip::tcp::no_delay  nodelay(true);
        boost::asio::socket_base::non_blocking_io none_block(true);
        conn->socket().io_control(none_block);
        if ( conn->socket().non_blocking() ){
            Logger::GetLogger()->Debug("None_Block");
        }else{
            Logger::GetLogger()->Debug("Block Socket");
        }
        conn->socket().set_option(nodelay);

        conn->Start();
//        Server::GetInstance()->RunTask(boost::bind(&TCPConnection::Start,conn));
    }
    else
    {
        Logger::GetLogger()->Error("error:%d",ec.value());
    }
    StartListen();
}