asio C++ library

PrevUpHomeNext

Streams, Short Reads and Short Writes

Many I/O objects in Asio are stream-oriented. This means that:

Objects that provide stream-oriented I/O model one or more of the following type requirements:

Examples of stream-oriented I/O objects include ip::tcp::socket, ssl::stream<>, posix::stream_descriptor, windows::stream_handle, etc.

Programs typically want to transfer an exact number of bytes. When a short read or short write occurs the program must restart the operation, and continue to do so until the required number of bytes has been transferred. Asio provides generic functions that do this automatically: read(), async_read(), write() and async_write().

Why EOF is an Error
See Also

async_read(), async_write(), read(), write(), AsyncReadStream, AsyncWriteStream, SyncReadStream, SyncWriteStream.


PrevUpHomeNext