<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>GNU Radio 3.2.2 C++ API: gr_udp_source Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.2 --> <div class="contents"> <h1>gr_udp_source Class Reference<br/> <small> [<a class="el" href="group__source__blk.html">Signal Sources</a>]</small> </h1><!-- doxytag: class="gr_udp_source" --><!-- doxytag: inherits="gr_sync_block" --> <p>Read stream from an UDP socket. <a href="#_details">More...</a></p> <p><code>#include <<a class="el" href="gr__udp__source_8h_source.html">gr_udp_source.h</a>></code></p> <div class="dynheader"> Inheritance diagram for gr_udp_source:</div> <div class="dynsection"> <div class="center"><img src="classgr__udp__source__inherit__graph.png" border="0" usemap="#gr__udp__source_inherit__map" alt="Inheritance graph"/></div> <map name="gr__udp__source_inherit__map" id="gr__udp__source_inherit__map"> <area shape="rect" id="node2" href="classgr__sync__block.html" title="synchronous 1:1 input to output with historyOverride work to provide the signal processing..." alt="" coords="7,160,113,189"/><area shape="rect" id="node4" href="classgr__block.html" title="The abstract base class for all 'terminal' processing blocks.A signal processing..." alt="" coords="25,83,95,112"/><area shape="rect" id="node6" href="classgr__basic__block.html" title="The abstract base class for all signal processing blocks.Basic blocks are the bare..." alt="" coords="5,5,115,35"/></map> <center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div> <p><a href="classgr__udp__source-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"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classgr__udp__source.html#aff679a619371a151f8f037eb8c206bb5">~gr_udp_source</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="gc__types_8h.html#a0f2b5d454b7e4dda3861032cfce91085">bool</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classgr__udp__source.html#aae7f8736725b5dcd638659f19166c018">open</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">open a socket specified by the port and ip address info <a href="#aae7f8736725b5dcd638659f19166c018"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classgr__udp__source.html#aa47a4308b57f48b6872505863106566c">close</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Close current socket. <a href="#aa47a4308b57f48b6872505863106566c"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classgr__udp__source.html#a09db2251d1f7406889104fb1e8aac0a0">payload_size</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">return the PAYLOAD_SIZE of the socket <a href="#a09db2251d1f7406889104fb1e8aac0a0"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classgr__udp__source.html#aafcc18df4c9ed93551dde48cce610f4e">work</a> (int noutput_items, <a class="el" href="classstd_1_1vector.html">gr_vector_const_void_star</a> &input_items, <a class="el" href="classstd_1_1vector.html">gr_vector_void_star</a> &output_items)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">just like <a class="el" href="classgr__block.html#a137b93d87dc83bbdb6369d33f4ea8197" title="compute output items from input items">gr_block::general_work</a>, only this arranges to call consume_each for you <a href="#aafcc18df4c9ed93551dde48cce610f4e"></a><br/></td></tr> <tr><td colspan="2"><h2>Protected Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classgr__udp__source.html#a61928d229b532ddb8c570fec8eef741d">gr_udp_source</a> (size_t itemsize, const char *src, unsigned short port_src, int payload_size)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">UDP Source Constructor. <a href="#a61928d229b532ddb8c570fec8eef741d"></a><br/></td></tr> <tr><td colspan="2"><h2>Friends</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classboost_1_1shared__ptr.html">gr_udp_source_sptr</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classgr__udp__source.html#ae521546a5df55919736bbf4fcd21c421">gr_make_udp_source</a> (size_t itemsize, const char *src, unsigned short port_src, int payload_size)</td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>Read stream from an UDP socket. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>itemsize</em> </td><td>The size (in bytes) of the item datatype </td></tr> <tr><td valign="top"></td><td valign="top"><em>src</em> </td><td>The source address as either the host name or the 'numbers-and-dots' IP address </td></tr> <tr><td valign="top"></td><td valign="top"><em>port_src</em> </td><td>The port number on which the socket listens for data </td></tr> <tr><td valign="top"></td><td valign="top"><em>payload_size</em> </td><td>UDP payload size by default set to 1472 = (1500 MTU - (8 byte UDP header) - (20 byte IP header)) </td></tr> </table> </dd> </dl> <hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="a61928d229b532ddb8c570fec8eef741d"></a><!-- doxytag: member="gr_udp_source::gr_udp_source" ref="a61928d229b532ddb8c570fec8eef741d" args="(size_t itemsize, const char *src, unsigned short port_src, int payload_size)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">gr_udp_source::gr_udp_source </td> <td>(</td> <td class="paramtype">size_t </td> <td class="paramname"> <em>itemsize</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"> <em>src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned short </td> <td class="paramname"> <em>port_src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>payload_size</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [protected]</code></td> </tr> </table> </div> <div class="memdoc"> <p>UDP Source Constructor. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>itemsize</em> </td><td>The size (in bytes) of the item datatype </td></tr> <tr><td valign="top"></td><td valign="top"><em>src</em> </td><td>The source address as either the host name or the 'numbers-and-dots' IP address </td></tr> <tr><td valign="top"></td><td valign="top"><em>port_src</em> </td><td>The port number on which the socket listens for data </td></tr> <tr><td valign="top"></td><td valign="top"><em>payload_size</em> </td><td>UDP payload size by default set to 1472 = (1500 MTU - (8 byte UDP header) - (20 byte IP header)) </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="aff679a619371a151f8f037eb8c206bb5"></a><!-- doxytag: member="gr_udp_source::~gr_udp_source" ref="aff679a619371a151f8f037eb8c206bb5" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">gr_udp_source::~gr_udp_source </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="aa47a4308b57f48b6872505863106566c"></a><!-- doxytag: member="gr_udp_source::close" ref="aa47a4308b57f48b6872505863106566c" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void gr_udp_source::close </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Close current socket. </p> <p>Shuts down read/write on the socket </p> </div> </div> <a class="anchor" id="aae7f8736725b5dcd638659f19166c018"></a><!-- doxytag: member="gr_udp_source::open" ref="aae7f8736725b5dcd638659f19166c018" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="gc__types_8h.html#a0f2b5d454b7e4dda3861032cfce91085">bool</a> gr_udp_source::open </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>open a socket specified by the port and ip address info </p> <p>Opens a socket, binds to the address, and waits for a connection over UDP. If any of these fail, the fuction retuns the error and exits. </p> </div> </div> <a class="anchor" id="a09db2251d1f7406889104fb1e8aac0a0"></a><!-- doxytag: member="gr_udp_source::payload_size" ref="a09db2251d1f7406889104fb1e8aac0a0" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int gr_udp_source::payload_size </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>return the PAYLOAD_SIZE of the socket </p> </div> </div> <a class="anchor" id="aafcc18df4c9ed93551dde48cce610f4e"></a><!-- doxytag: member="gr_udp_source::work" ref="aafcc18df4c9ed93551dde48cce610f4e" args="(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int gr_udp_source::work </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"> <em>noutput_items</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classstd_1_1vector.html">gr_vector_const_void_star</a> & </td> <td class="paramname"> <em>input_items</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classstd_1_1vector.html">gr_vector_void_star</a> & </td> <td class="paramname"> <em>output_items</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>just like <a class="el" href="classgr__block.html#a137b93d87dc83bbdb6369d33f4ea8197" title="compute output items from input items">gr_block::general_work</a>, only this arranges to call consume_each for you </p> <p>The user must override work to define the signal processing code </p> <p>Implements <a class="el" href="classgr__sync__block.html#a0c523f4285a6eb690f677ee6295ab117">gr_sync_block</a>.</p> </div> </div> <hr/><h2>Friends And Related Function Documentation</h2> <a class="anchor" id="ae521546a5df55919736bbf4fcd21c421"></a><!-- doxytag: member="gr_udp_source::gr_make_udp_source" ref="ae521546a5df55919736bbf4fcd21c421" args="(size_t itemsize, const char *src, unsigned short port_src, int payload_size)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classboost_1_1shared__ptr.html">gr_udp_source_sptr</a> gr_make_udp_source </td> <td>(</td> <td class="paramtype">size_t </td> <td class="paramname"> <em>itemsize</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"> <em>src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned short </td> <td class="paramname"> <em>port_src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>payload_size</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [friend]</code></td> </tr> </table> </div> <div class="memdoc"> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="gr__udp__source_8h_source.html">gr_udp_source.h</a></li> </ul> </div> <hr size="1"/><address style="text-align: right;"><small>Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2 </small></address> </body> </html>