3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Serial Ports</title>
5 <link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
7 <link rel="home" href="../../boost_asio.html" title="Boost.Asio">
8 <link rel="up" href="../overview.html" title="Overview">
9 <link rel="prev" href="timers.html" title="Timers">
10 <link rel="next" href="signals.html" title="Signal Handling">
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
15 <td align="center"><a href="../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../more/index.htm">More</a></td>
22 <div class="spirit-nav">
23 <a accesskey="p" href="timers.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="signals.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
26 <div class="titlepage"><div><div><h3 class="title">
27 <a name="boost_asio.overview.serial_ports"></a><a class="link" href="serial_ports.html" title="Serial Ports">Serial Ports</a>
28 </h3></div></div></div>
30 Boost.Asio includes classes for creating and manipulating serial ports in
31 a portable manner. For example, a serial port may be opened using:
33 <pre class="programlisting"><span class="identifier">serial_port</span> <span class="identifier">port</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">,</span> <span class="identifier">name</span><span class="special">);</span>
36 where name is something like <code class="computeroutput"><span class="string">"COM1"</span></code>
37 on Windows, and <code class="computeroutput"><span class="string">"/dev/ttyS0"</span></code>
41 Once opened, the serial port may be used as a <a class="link" href="core/streams.html" title="Streams, Short Reads and Short Writes">stream</a>.
42 This means the objects can be used with any of the <a class="link" href="../reference/read.html" title="read">read()</a>,
43 <a class="link" href="../reference/async_read.html" title="async_read">async_read()</a>, <a class="link" href="../reference/write.html" title="write">write()</a>, <a class="link" href="../reference/async_write.html" title="async_write">async_write()</a>,
44 <a class="link" href="../reference/read_until.html" title="read_until">read_until()</a> or <a class="link" href="../reference/async_read_until.html" title="async_read_until">async_read_until()</a>
48 The serial port implementation also includes option classes for configuring
49 the port's baud rate, flow control type, parity, stop bits and character
53 <a name="boost_asio.overview.serial_ports.h0"></a>
54 <span class="phrase"><a name="boost_asio.overview.serial_ports.see_also"></a></span><a class="link" href="serial_ports.html#boost_asio.overview.serial_ports.see_also">See
58 <a class="link" href="../reference/serial_port.html" title="serial_port">serial_port</a>, <a class="link" href="../reference/serial_port_base.html" title="serial_port_base">serial_port_base</a>,
59 <a class="link" href="../reference/basic_serial_port.html" title="basic_serial_port">basic_serial_port</a>,
60 <a class="link" href="../reference/serial_port_service.html" title="serial_port_service">serial_port_service</a>,
61 <a class="link" href="../reference/serial_port_base__baud_rate.html" title="serial_port_base::baud_rate">serial_port_base::baud_rate</a>,
62 <a class="link" href="../reference/serial_port_base__flow_control.html" title="serial_port_base::flow_control">serial_port_base::flow_control</a>,
63 <a class="link" href="../reference/serial_port_base__parity.html" title="serial_port_base::parity">serial_port_base::parity</a>,
64 <a class="link" href="../reference/serial_port_base__stop_bits.html" title="serial_port_base::stop_bits">serial_port_base::stop_bits</a>,
65 <a class="link" href="../reference/serial_port_base__character_size.html" title="serial_port_base::character_size">serial_port_base::character_size</a>.
68 <a name="boost_asio.overview.serial_ports.h1"></a>
69 <span class="phrase"><a name="boost_asio.overview.serial_ports.notes"></a></span><a class="link" href="serial_ports.html#boost_asio.overview.serial_ports.notes">Notes</a>
72 Serial ports are available on all POSIX platforms. For Windows, serial ports
73 are only available at compile time when the I/O completion port backend is
74 used (which is the default). A program may test for the macro <code class="computeroutput"><span class="identifier">BOOST_ASIO_HAS_SERIAL_PORT</span></code> to determine
75 whether they are supported.
78 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
79 <td align="left"></td>
80 <td align="right"><div class="copyright-footer">Copyright © 2003-2014 Christopher M. Kohlhoff<p>
81 Distributed under the Boost Software License, Version 1.0. (See accompanying
82 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
87 <div class="spirit-nav">
88 <a accesskey="p" href="timers.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="signals.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>