Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Boost.Asio C++ Network Programming

You're reading from   Boost.Asio C++ Network Programming Learn effective C++ network programming with Boost.Asio and become a proficient C++ network programmer

Arrow left icon
Product type Paperback
Published in Sep 2015
Publisher
ISBN-13 9781785283079
Length 200 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Wisnu Anggoro Wisnu Anggoro
Author Profile Icon Wisnu Anggoro
Wisnu Anggoro
Arrow right icon
View More author details
Toc

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.

Note

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

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image