<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>GearBox Project</title> <link rel="icon" href="gbx_icon_cardbox_sky.png" type="image/png"> <link rel="shortcut icon" href="gbx_icon_cardbox_sky.png" type="image/png"> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> <!-- Google Analytics --> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-3583782-1"); pageTracker._initData(); pageTracker._trackPageview(); </script> <!-- Returning you to your regular programming --> </head><body> <!-- Header --> <table border="0" cellspacing="0" cellpadding="0"> <tr><!-- create row --> <!-- spacer cell --> <!-- #CC CC CC --> <td rowspan="1" colspan="1" bgcolor="#EEEEEE"> </td> <!-- menu cell --> <td width="170" rowspan="1" colspan="1" align="left" valign="top" bgcolor="#EEEEEE"> <p> </p> <p align="center"><a href="index.html"><img src="gbx_logo_cardbox_sky_150x150.png"></a></p><br> <strong>INTRODUCTION</strong><br> <strong><a href="gbx_doc_overview.html" style="text-decoration:none">Overview</a></strong><br> <strong><a href="gbx_doc_getting.html" style="text-decoration:none">Download and Install</a></strong><br> <!-- <strong><a href="gbx_doc_quickstart.html" style="text-decoration:none">Quick Start</a></strong><br> --> <strong><a href="gbx_doc_documentation.html" style="text-decoration:none">Documentation</a></strong><br> <strong><a href="gbx_doc_publications.html" style="text-decoration:none">Publications</a></strong><br> <br> <strong>REPOSITORY</strong><br> <strong><a href="group__gbx__libs.html" style="text-decoration:none">Libraries</a></strong><br> <!-- <strong><a href="group__gbx__utils.html" style="text-decoration:none">Utilities</a></strong><br> --> <br> <strong>DEVELOPER</strong><br> <!--<strong><a href="gbx_doc_tutorials.html" style="text-decoration:none">Tutorials</a></strong><br> <strong><a href="group__gbx__examples.html" style="text-decoration:none">Examples</a></strong><br>--> <strong><a href="gbx_doc_devguide.html" style="text-decoration:none">Dev Guide</a></strong><br> <!-- <strong><a href="gbx_doc_faq.html" style="text-decoration:none">FAQ</a></strong><br> --> <strong><a href="http://cdash.acfr.usyd.edu.au/index.php?project=Gearbox" style="text-decoration:none">Dashboard</a></strong><br> <!--<strong><a href="http://wiki2.cas.edu.au/orca">Wiki</a></strong><br> login/pass: orca/orca<br>--> <br> <strong>PEOPLE</strong><br> <strong><a href="gbx_doc_contributors.html" style="text-decoration:none">Contributors</a></strong><br> <strong><a href="gbx_doc_users.html" style="text-decoration:none">Users</a></strong><br> <br> <a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=216468&type=2" width="125" height="37" border="0" alt="SourceForge.net Logo" /></a><br> <strong><a href="http://sourceforge.net/projects/gearbox">Project</a></strong><br> <strong><a href="http://sourceforge.net/project/showfiles.php?group_id=216468">Download</a></strong><br> <!--<strong><a href="http://sourceforge.net/tracker/?group_id=216468">Bugs/Feedback</a></strong><br>--> <strong><a href="http://sourceforge.net/mail/?group_id=216468">Mailing lists</a></strong></p> <p> </p> </td><!-- /menu cell --> <!-- one grey spacer cells --> <td rowspan="1" colspan="1" bgcolor="#EEEEEE"> </td> <!-- one white spacer cells --> <td rowspan="1" colspan="1"> </td> <!-- main content cell --> <td rowspan="1" colspan="1" align="left" valign="top"> <!-- Generated by Doxygen 1.6.2-20100208 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="namespaceflexiport.html">flexiport</a>::<a class="el" href="classflexiport_1_1UDPPort.html">UDPPort</a> </div> </div> <div class="contents"> <h1>flexiport::UDPPort Class Reference</h1><!-- doxytag: class="flexiport::UDPPort" --><!-- doxytag: inherits="flexiport::Port" --> <p>UDP implementation of the <a class="el" href="classflexiport_1_1Port.html">Port</a> class. This class provides UDP communication between two known end points. It cannot send to any address other than the configured address. <a href="#_details">More...</a></p> <p><code>#include <<a class="el" href="udpport_8h_source.html">udpport.h</a>></code></p> <p>Inherits <a class="el" href="classflexiport_1_1Port.html">flexiport::Port</a>.</p> <p><a href="classflexiport_1_1UDPPort-members.html">List of all members.</a></p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classflexiport_1_1UDPPort.html#a8cf375bb72851dfa46c54c9f43e836cf">Open</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Open the port. <a href="#a8cf375bb72851dfa46c54c9f43e836cf"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8e984094237c4c1c495d7630a41ffb1b"></a><!-- doxytag: member="flexiport::UDPPort::Close" ref="a8e984094237c4c1c495d7630a41ffb1b" args="()" --> void </td><td class="memItemRight" valign="bottom"><a class="el" href="classflexiport_1_1UDPPort.html#a8e984094237c4c1c495d7630a41ffb1b">Close</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Close the port. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad310fedf85687caf8c85366d2b2d1d0a"></a><!-- doxytag: member="flexiport::UDPPort::Read" ref="ad310fedf85687caf8c85366d2b2d1d0a" args="(void *const buffer, size_t count)" --> ssize_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classflexiport_1_1UDPPort.html#ad310fedf85687caf8c85366d2b2d1d0a">Read</a> (void *const buffer, size_t count)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Read from the port. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a21f4c4d1592f3afc9bd149224dfa27a0"></a><!-- doxytag: member="flexiport::UDPPort::ReadFull" ref="a21f4c4d1592f3afc9bd149224dfa27a0" args="(void *const buffer, size_t count)" --> ssize_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classflexiport_1_1UDPPort.html#a21f4c4d1592f3afc9bd149224dfa27a0">ReadFull</a> (void *const buffer, size_t count)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Read the requested quantity of data from the port. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a82296bf94266b3d4338623be3cd94139"></a><!-- doxytag: member="flexiport::UDPPort::ReadUntil" ref="a82296bf94266b3d4338623be3cd94139" args="(void *const buffer, size_t count, uint8_t terminator)" --> ssize_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classflexiport_1_1UDPPort.html#a82296bf94266b3d4338623be3cd94139">ReadUntil</a> (void *const buffer, size_t count, uint8_t terminator)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Read data until a specified termination byte is received. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aee853804bf02d8aca9adc08fab14ee87"></a><!-- doxytag: member="flexiport::UDPPort::ReadStringUntil" ref="aee853804bf02d8aca9adc08fab14ee87" args="(std::string &buffer, char terminator)" --> ssize_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classflexiport_1_1UDPPort.html#aee853804bf02d8aca9adc08fab14ee87">ReadStringUntil</a> (std::string &buffer, char terminator)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Read a string until the specified termination character is received. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8b860b67a0c93a5bed2e5a22c2bb6dcc"></a><!-- doxytag: member="flexiport::UDPPort::Skip" ref="a8b860b67a0c93a5bed2e5a22c2bb6dcc" args="(size_t count)" --> ssize_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classflexiport_1_1UDPPort.html#a8b860b67a0c93a5bed2e5a22c2bb6dcc">Skip</a> (size_t count)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Dump data until the specified number of bytes have been read. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9b9e08ef9f76a29c2cfe81b466dc470c"></a><!-- doxytag: member="flexiport::UDPPort::SkipUntil" ref="a9b9e08ef9f76a29c2cfe81b466dc470c" args="(uint8_t terminator, unsigned int count)" --> ssize_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classflexiport_1_1UDPPort.html#a9b9e08ef9f76a29c2cfe81b466dc470c">SkipUntil</a> (uint8_t terminator, unsigned int count)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Read and dump data until the specified termination character has been seen count times. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a276fbd4eb3c2f5f8b9bdd1dd94f191e4"></a><!-- doxytag: member="flexiport::UDPPort::BytesAvailable" ref="a276fbd4eb3c2f5f8b9bdd1dd94f191e4" args="()" --> ssize_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classflexiport_1_1UDPPort.html#a276fbd4eb3c2f5f8b9bdd1dd94f191e4">BytesAvailable</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Get the number of bytes waiting to be read at the port. Returns immediatly. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a59b974d567e59b93ed44e65c85d7c6fa"></a><!-- doxytag: member="flexiport::UDPPort::BytesAvailableWait" ref="a59b974d567e59b93ed44e65c85d7c6fa" args="()" --> ssize_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classflexiport_1_1UDPPort.html#a59b974d567e59b93ed44e65c85d7c6fa">BytesAvailableWait</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Get the number of bytes waiting after blocking for the timeout. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="abf30f2c48bd455684b4bfc6b02005ef5"></a><!-- doxytag: member="flexiport::UDPPort::Write" ref="abf30f2c48bd455684b4bfc6b02005ef5" args="(const void *const buffer, size_t count)" --> ssize_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classflexiport_1_1UDPPort.html#abf30f2c48bd455684b4bfc6b02005ef5">Write</a> (const void *const buffer, size_t count)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Write data to the port. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa1565aa543d662cc5d6d0d3f49ab9011"></a><!-- doxytag: member="flexiport::UDPPort::Flush" ref="aa1565aa543d662cc5d6d0d3f49ab9011" args="()" --> void </td><td class="memItemRight" valign="bottom"><a class="el" href="classflexiport_1_1UDPPort.html#aa1565aa543d662cc5d6d0d3f49ab9011">Flush</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Flush the port's input and output buffers, discarding all data. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae50f7894e5a6d462292f35da64e9590c"></a><!-- doxytag: member="flexiport::UDPPort::Drain" ref="ae50f7894e5a6d462292f35da64e9590c" args="()" --> void </td><td class="memItemRight" valign="bottom"><a class="el" href="classflexiport_1_1UDPPort.html#ae50f7894e5a6d462292f35da64e9590c">Drain</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Drain the port's input and output buffers. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2f72b44de99232e2895f888051c015fb"></a><!-- doxytag: member="flexiport::UDPPort::GetStatus" ref="a2f72b44de99232e2895f888051c015fb" args="() const " --> std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="classflexiport_1_1UDPPort.html#a2f72b44de99232e2895f888051c015fb">GetStatus</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Get the status of the port (type, device, etc). <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a99eff94d36f76d4ebea8429928c15c0c"></a><!-- doxytag: member="flexiport::UDPPort::SetTimeout" ref="a99eff94d36f76d4ebea8429928c15c0c" args="(Timeout timeout)" --> void </td><td class="memItemRight" valign="bottom"><a class="el" href="classflexiport_1_1UDPPort.html#a99eff94d36f76d4ebea8429928c15c0c">SetTimeout</a> (<a class="el" href="classflexiport_1_1Timeout.html">Timeout</a> timeout)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Set the timeout value in milliseconds. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a042ac897f875dade46d3fefcee3383c3"></a><!-- doxytag: member="flexiport::UDPPort::SetCanRead" ref="a042ac897f875dade46d3fefcee3383c3" args="(bool canRead)" --> void </td><td class="memItemRight" valign="bottom"><a class="el" href="classflexiport_1_1UDPPort.html#a042ac897f875dade46d3fefcee3383c3">SetCanRead</a> (bool canRead)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Set the read permissions of the port. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aba3eb389458b520e0875cddeda42a2e9"></a><!-- doxytag: member="flexiport::UDPPort::SetCanWrite" ref="aba3eb389458b520e0875cddeda42a2e9" args="(bool canWrite)" --> void </td><td class="memItemRight" valign="bottom"><a class="el" href="classflexiport_1_1UDPPort.html#aba3eb389458b520e0875cddeda42a2e9">SetCanWrite</a> (bool canWrite)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Set the write permissions of the port. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa0cf22123572524670ab795d21d2c1b9"></a><!-- doxytag: member="flexiport::UDPPort::IsOpen" ref="aa0cf22123572524670ab795d21d2c1b9" args="() const " --> bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classflexiport_1_1UDPPort.html#aa0cf22123572524670ab795d21d2c1b9">IsOpen</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Check if the port is open. <br/></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>UDP implementation of the <a class="el" href="classflexiport_1_1Port.html">Port</a> class. This class provides UDP communication between two known end points. It cannot send to any address other than the configured address. </p> <p>See the <a class="el" href="classflexiport_1_1Port.html">Port</a> class documentation for how to use the common API. Note that some parts of the API do not apply due to the nature of the datagram-oriented protocol. Because each datagram is individual and no merging is typically performed between datagrams, several flexiport functions do not work (they were designed for stream-oriented communications). These are <a class="el" href="classflexiport_1_1UDPPort.html#aee853804bf02d8aca9adc08fab14ee87">ReadStringUntil</a>, <a class="el" href="classflexiport_1_1Port.html#adccf67379fcdf9d48a7d89df7ee74e80">ReadLine</a> (std::string version), <a class="el" href="classflexiport_1_1UDPPort.html#a8b860b67a0c93a5bed2e5a22c2bb6dcc">Skip</a>, and <a class="el" href="classflexiport_1_1UDPPort.html#a9b9e08ef9f76a29c2cfe81b466dc470c">SkipUntil</a>. This will be (hopefully) be fixed soon.</p> <p>TODO: Add support for configuring the destination address based on the first data received, to allow destination auto-configuration. TODO: Add an option to turn buffering on, making the UDP protocol function like a stream-based protocol and so enabling the use of those parts of the API that do not function correctly for a datagram-based protocol. Alternatively, fix the functions that don't work yet so they read more than a byte at a time.</p> <dl class="user"><dt><b>Options</b></dt><dd><ul> <li>dest_ip <string><ul> <li>IP address to send data to.</li> <li>Default: 127.0.0.1</li> </ul> </li> <li>dest_port <integer><ul> <li>UDP port to send data to.</li> <li>Default: 20000</li> </ul> </li> <li>recv_ip <string><ul> <li>IP address to receive data on. Set to "*" for receiving on any interface.</li> <li>Default: *</li> </ul> </li> <li>recv_port <integer><ul> <li>UDP port to receive data on.</li> <li>Default: 20000 </li> </ul> </li> </ul> </dd></dl> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="a8cf375bb72851dfa46c54c9f43e836cf"></a><!-- doxytag: member="flexiport::UDPPort::Open" ref="a8cf375bb72851dfa46c54c9f43e836cf" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void flexiport::UDPPort::Open </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td> <td> ) </td> <td><code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Open the port. </p> <p>This will create a listening socket and a sending socket. </p> <p>Implements <a class="el" href="classflexiport_1_1Port.html#a8c58be7e0aa0ee292ab47501520ff870">flexiport::Port</a>.</p> <p>Referenced by <a class="el" href="udpport_8cpp_source.html#l00210">Read()</a>, and <a class="el" href="udpport_8cpp_source.html#l00311">ReadFull()</a>.</p> </div> </div> <hr/>The documentation for this class was generated from the following files:<ul> <li><a class="el" href="udpport_8h_source.html">udpport.h</a></li> <li>udpport.cpp</li> </ul> </div> </td> <td colspan="1"> </td> </tr> </table> <!-- end of table --> <hr size="1"><address style="align: right;"><small>Generated for GearBox by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.5 </small></address> </body> </html>