Boost.Asio includes classes for creating and manipulating serial ports in a portable manner. For example, a serial port may be opened using:
serial_port port(my_io_context, name);
where name is something like
on Windows, and
on POSIX platforms.
Once opened, the serial port may be used as a stream. This means the objects can be used with any of the read(), async_read(), write(), async_write(), read_until() or async_read_until() free functions.
The serial port implementation also includes option classes for configuring the port's baud rate, flow control type, parity, stop bits and character size.
Serial ports are available on all POSIX platforms. For Windows, serial ports
are only available at compile time when the I/O completion port backend is
used (which is the default). A program may test for the macro
BOOST_ASIO_HAS_SERIAL_PORT to determine
whether they are supported.