Exemple #1
0
    size_t write_some( AsyncWriteStream& s, const ConstBufferSequence& buf ) {
        detail::non_blocking<AsyncWriteStream> non_blocking;

        if( non_blocking(s) || non_blocking(s,true) ) {
            boost::system::error_code ec;
            size_t r = s.write_some( buf, ec );
            if( !ec ) return r;
            if( ec != boost::asio::error::would_block) {
                BOOST_THROW_EXCEPTION( boost::system::system_error(ec) );
            }
        }
        promise<size_t>::ptr p(new promise<size_t>("fc::asio::write_some"));
        s.async_write_some( buf, boost::bind( detail::read_write_handler, p, _1, _2 ) );
        return p->wait();
    }
Exemple #2
0
 void async_write_some(AsyncWriteStream& s, const std::shared_ptr<const char>& buffer, 
                       size_t length, size_t offset, promise<size_t>::ptr completion_promise) {
   s.async_write_some(boost::asio::buffer(buffer.get() + offset, length), 
                      detail::read_write_handler_with_buffer(completion_promise, buffer));
 }
Exemple #3
0
 void async_write_some(AsyncWriteStream& s, const char* buffer, 
                       size_t length, promise<size_t>::ptr completion_promise) {
   s.async_write_some(boost::asio::buffer(buffer, length), 
                      detail::read_write_handler(completion_promise));
 }
Exemple #4
0
 void async_write_some(AsyncWriteStream& s, const ConstBufferSequence& buf, promise<size_t>::ptr completion_promise) {
   s.async_write_some(buf, detail::read_write_handler(completion_promise));
 }
Exemple #5
0
 future<size_t> write_some( AsyncWriteStream& s, const std::shared_ptr<const char>& buffer, 
                            size_t length, size_t offset ) {
     promise<size_t>::ptr p(new promise<size_t>("fc::asio::write_some"));
     s.async_write_some( boost::asio::buffer(buffer.get() + offset, length), detail::read_write_handler_with_buffer(p, buffer));
     return p; //->wait();
 }
Exemple #6
0
 future<size_t> write_some( AsyncWriteStream& s, const char* buffer, 
                            size_t length, size_t offset = 0) {
     promise<size_t>::ptr p(new promise<size_t>("fc::asio::write_some"));
     s.async_write_some( boost::asio::buffer(buffer + offset, length), detail::read_write_handler(p));
     return p; //->wait();
 }
Exemple #7
0
 future<size_t> write_some( AsyncWriteStream& s, const ConstBufferSequence& buf ) {
     promise<size_t>::ptr p(new promise<size_t>("fc::asio::write_some"));
     s.async_write_some( buf, detail::read_write_handler(p));
     return p; //->wait();
 }