Boost.Asio C++ Network Programming


I recently finished reading “Boost.Asio C++ Network Programming” written by John Torjo and published by Packt Publishing. Information given by the publisher:

Overview:

  • Augment your C++ network programming using Boost.Asio
  • Discover how Boost.Asio handles synchronous and asynchronous programming models
  • Practical examples of client/server applications
  • Learn how to deal with threading when writing network applications
  • Harness the power of Boost with plenty of examples that you can build upon

What you will learn from this book:

  • How to easily reference Boost.Asio programming
  • Synchronous versus asynchronous using Boost.Asio
  • How threading affects programming using Boost.Asio
  • Create your own echo client and server
  • More examples of client/server applications, both synchronous and asynchronous
  • Implement your own asynchronous operations
  • Co-routines: asynchronous operations with a synchronous feel
  • Use Boost.Asio for SSL Networking
  • Debug Boost.Asio
  • Use Boost.Asio for more than just networking

I love the Boost libraries, and I’m interested in network programming, so I decided to read this book. The book has a hands-on approach with a couple of sample programs. What I like is that these sample programs have been structured in such a way so they can be reused for your own projects. They are like skeleton examples, and all source code can be downloaded from the book’s website.

The book does not cover any real networking theory. For example don’t expect an in-depth discussion of how the TCP, UDP, or ICMP protocols work; that’s not the goal of this book. The goal is to show, with practical examples, how to use the Boost.Asio networking library.

While reading chapter 1, my initial reaction to the contents was rather negative. Chapter 1 is a bit convoluted, not so easy to understand, and even has a couple of errors in it. However, subsequent chapters are structured more logically and are understandable, though sometimes a discussion accompanying a piece of code can be a bit brief.

As an introduction to the library, Chapter 3 shows a basic Echo client/server example which is quite good. There is a synchronous and asynchronous TCP implementation of the client and server, and also a synchronous UDP implementation of the client and server. Subsequent chapters implement more useful client/server applications.

The book is not your one-stop destination for everything related to the Boost.Asio library, but it’s a great introduction to get you started with the library, to get to know the terminology used in the library, to learn about the difference between synchronous and asynchronous programming, to learn how to use multi-threading using the Boost threading library, and to get nice skeleton applications that you can reuse in your own projects. Several skeleton applications are provided such as synchronous and asynchronous versions, and single-threaded and multi-threaded versions.

Share

1 Comment so far »

  1. John Torjo said,

    Wrote on April 3, 2013 @ 4:29 pm

    Hi Mark,

    Thanks for the very very nice review! Please note that any feedback/comments/suggestions you might have – you can drop me an email (at the address shown on my website – http://www.torjo.com)
    About chapter 1 – please, when/if you have time, drop me an email with the problems you found – we’ll very likely publish an errata at some point. Thanks again!

    Best,
    John

Comment RSS · TrackBack URI

Leave a Comment

Name: (Required)

E-mail: (Required)

Website:

Comment: