Completion Condition Function Objects


Functions

detail::transfer_all_t asio::transfer_all ()
detail::transfer_at_least_t asio::transfer_at_least (std::size_t minimum)

Detailed Description

Function objects used for determining when a read or write operation should complete.

Function Documentation

detail::transfer_all_t asio::transfer_all (  )  [inline]

Return a completion condition function object that indicates that a read or write operation should continue until all of the data has been transferred, or until an error occurs. This function is used to create an object, of unspecified type, that meets CompletionCondition requirements.

Example
Reading until a buffer is full:
 boost::array<char, 128> buf;
 asio::error_code ec;
 std::size_t n = asio::read(
     sock, asio::buffer(buf),
     asio::transfer_all(), ec);
 if (ec)
 {
   // An error occurred.
 }
 else
 {
   // n == 128
 }

detail::transfer_at_least_t asio::transfer_at_least ( std::size_t  minimum  )  [inline]

Return a completion condition function object that indicates that a read or write operation should continue until a minimum number of bytes has been transferred, or until an error occurs. This function is used to create an object, of unspecified type, that meets CompletionCondition requirements.

Example
Reading until a buffer is full or contains at least 64 bytes:
 boost::array<char, 128> buf;
 asio::error_code ec;
 std::size_t n = asio::read(
     sock, asio::buffer(buf),
     asio::transfer_at_least(64), ec);
 if (ec)
 {
   // An error occurred.
 }
 else
 {
   // n >= 64 && n <= 128
 }


Generated on Thu Sep 9 03:00:06 2010 for rphp by  doxygen 1.5.4