test/ttimeout.cc
/* Send the request and wait for a response string, &result.
 * n.b. Caller should terminate the request with newline.
 */
Send the request and wait for a response string, &result.
Send the request and wait for a response string &result .
bool tclient::raw_transaction( const char* req, std::string &result )
{
    bool status=false;
    if (!m_connected) return false;
    try {
        size_t rlen = std::strlen(req);
        boost::asio::write( m_socket, boost::asio::buffer(req,rlen) );
        std::cout << "tclient wrote Request: '" << req;
        boost::posix_time::seconds timeout(5);
        readWithTimeout( result, timeout );
        status = true;
        std::cout << "tclient read Reply (" << result.length()
                  << " bytes): " << result << "\n";
    } catch (std::exception &e) {
        std::cerr << "tclient raw_transaction: " << e.what() << "\n";
        status = false;
    }
    return status;
}
bool tclient :: raw_transaction ( const char * req , std :: string & result ) { bool status = false ; if ( ! m_connected ) return false ; try { size_t rlen = std :: strlen ( req ) ; boost :: asio :: write ( m_socket , boost :: asio :: buffer ( req , rlen ) ) ; std :: cout << " " << req ; boost :: posix_time :: seconds timeout ( 5 ) ; readWithTimeout ( result , timeout ) ; status = true ; std :: cout << " " << result . length ( ) << " " << result << " \n " ; } catch ( std :: exception & e ) { std :: cerr << " " << e . what ( ) << " \n " ; status = false ; } return status ; }
Send the request and wait for a response string, &result.
Send the request and wait for a response string &result .
//