Book Image

Boost.Asio C++ Network Programming

By : Wisnu Anggoro
Book Image

Boost.Asio C++ Network Programming

By: Wisnu Anggoro

Overview of this book

Table of Contents (15 chapters)
Boost.Asio C++ Network Programming Second Edition
About the Authors
About the Reviewers

Examining the I/O service in the Boost.Asio library

The core object of the Boost::Asio namespace is io_service. The I/O service is a channel that is used to access operating system resources and establish communication between our program and the operating system that performs I/O requests. There is also an I/O object that has the role of submitting I/O requests. For instance, the tcp::socket object will provide a socket programming request from our program to the operating system.

Using and blocking the run() function

One of the most frequently used functions in the I/O service object is the run() function. It is used to run the io_service object's event processing loop. It will block the next statement program until all the work in the io_service object is completed and there are no more handlers to be dispatched. If we stop the io_service object, it will no longer block the program.


In programming, event is an action or occurrence detected by a program, which will be handled by the program...