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 Cookbook

You're reading from   Boost.Asio C++ Network Programming Cookbook Over 25 hands-on recipes to create robust and highly-efficient cross-platform distributed applications with the Boost.Asio library

Arrow left icon
Product type Paperback
Published in Jan 2016
Publisher
ISBN-13 9781783986545
Length 248 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Dmytro Radchuk Dmytro Radchuk
Author Profile Icon Dmytro Radchuk
Dmytro Radchuk
Arrow right icon
View More author details
Toc

Using timers


Timing is a very important aspect of software systems in general and distributed applications in particular. Therefore a hardware timer—a device used to measure time intervals—is essential component of any computer and all modern operating systems provide interface allowing applications to use it.

There are two typical use cases related to the timer. The first one assumes that the application wants to know the current time and asks the operating system to find it out. The second use case is when the application asks the operating system to notify it (usually, by means of invoking a callback) when a certain amount of time elapses.

The second use case is particularly important when it comes to developing distributed applications with Boost.Asio because a timer is the only way to implement the timeout mechanism for asynchronous operations.

The Boost.Asio library includes several classes that implement timers, which we will consider in this recipe.

How to do it…

The Boost.Asio library...

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