Networking TS

PrevUpHomeNext

transfer_at_least

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.

unspecified transfer_at_least(
    std::size_t minimum);

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;
std::error_code ec;
std::size_t n = std::experimental::net::read(
    sock, std::experimental::net::buffer(buf),
    std::experimental::net::transfer_at_least(64), ec);
if (ec)
{
  // An error occurred.
}
else
{
  // n >= 64 && n <= 128
}

PrevUpHomeNext