O'Reilly logo

Boost.Asio C++ Network Programming by John Torjo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Not just networking

Boost.Asio, in addition to networking, provides other input/output facilities.

Boost.Asio allows waiting for signals, such as SIGTERM (software terminate), SIGINT (signal interrupt), SIGSEGV (segment violation), and so on.

You create a signal_set instance, and specify what signals to asynchronously wait for, and when any of them happen, your asynchronous handler is called:

void signal_handler(const boost::system::error_code & err, int signal) {
    // log this, and terminate application
}

boost::asio::signal_set sig(service, SIGINT, SIGTERM);
sig.async_wait(signal_handler);

If SIGINT is generated, you'll catch it in your signal_handler callback.

Using Boost.Asio, you can easily connect to a serial port. The port name is COM7 on Windows, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required