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_service, 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_port, serial_port_base, basic_serial_port, serial_port_service, serial_port_base::baud_rate, serial_port_base::flow_control, serial_port_base::parity, serial_port_base::stop_bits, serial_port_base::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_PORTS to determine
whether they are supported.