1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
<HTML>
<HEAD>
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<CENTER>
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
<HR>
<!-- Generated by Doxygen 1.6.2 -->
<div class="navpath"><a class="el" href="namespacestk.html">stk</a>::<a class="el" href="classstk_1_1TcpServer.html">TcpServer</a>
</div>
<div class="contents">
<h1>stk::TcpServer Class Reference</h1><!-- doxytag: class="stk::TcpServer" --><!-- doxytag: inherits="stk::Socket" -->
<p>STK TCP socket server class.
<a href="#_details">More...</a></p>
<p><code>#include <<a class="el" href="TcpServer_8h_source.html">TcpServer.h</a>></code></p>
<div class="dynheader">
Inheritance diagram for stk::TcpServer:</div>
<div class="dynsection">
<div class="center">
<img src="classstk_1_1TcpServer.png" usemap="#stk::TcpServer_map" alt=""/>
<map id="stk::TcpServer_map" name="stk::TcpServer_map">
<area href="classstk_1_1Socket.html" alt="stk::Socket" shape="rect" coords="0,56,93,80"/>
<area href="classstk_1_1Stk.html" alt="stk::Stk" shape="rect" coords="0,0,93,24"/>
</map>
</div>
</div>
<p><a href="classstk_1_1TcpServer-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="classstk_1_1TcpServer.html#a0fc92fd76f406ab8eeabbeb27ba9a2fc">TcpServer</a> (int port=2006)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Default constructor creates a local socket server on port 2006 (or the specified port number). <a href="#a0fc92fd76f406ab8eeabbeb27ba9a2fc"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a07ccec68a41a10fbe9f1e9e9db3a85bd"></a><!-- doxytag: member="stk::TcpServer::~TcpServer" ref="a07ccec68a41a10fbe9f1e9e9db3a85bd" args="()" -->
</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1TcpServer.html#a07ccec68a41a10fbe9f1e9e9db3a85bd">~TcpServer</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">The class destructor closes the socket instance, breaking any existing connections. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1TcpServer.html#a421e255c3a250c5ac5d9e9642049cb9e">accept</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Extract the first pending connection request from the queue and create a new connection, returning the descriptor for the accepted socket. <a href="#a421e255c3a250c5ac5d9e9642049cb9e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4294c5eac74ee54c5367c41e1ee01741"></a><!-- doxytag: member="stk::TcpServer::writeBuffer" ref="a4294c5eac74ee54c5367c41e1ee01741" args="(const void *buffer, long bufferSize, int flags=0)" -->
int </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1TcpServer.html#a4294c5eac74ee54c5367c41e1ee01741">writeBuffer</a> (const void *buffer, long bufferSize, int flags=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Write a buffer over the socket connection. Returns the number of bytes written or -1 if an error occurs. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aafdf74764425a3044093647661ed1927"></a><!-- doxytag: member="stk::TcpServer::readBuffer" ref="aafdf74764425a3044093647661ed1927" args="(void *buffer, long bufferSize, int flags=0)" -->
int </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1TcpServer.html#aafdf74764425a3044093647661ed1927">readBuffer</a> (void *buffer, long bufferSize, int flags=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Read a buffer from the socket connection, up to length <em>bufferSize</em>. Returns the number of bytes read or -1 if an error occurs. <br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>STK TCP socket server class. </p>
<p>This class provides a uniform cross-platform TCP socket server interface. Methods are provided for reading or writing data buffers to/from connections.</p>
<p>TCP sockets are reliable and connection-oriented. A TCP socket server must accept a connection from a TCP client before data can be sent or received. Data delivery is guaranteed in order, without loss, error, or duplication. That said, TCP transmissions tend to be slower than those using the UDP protocol and data sent with multiple <em>write()</em> calls can be arbitrarily combined by the underlying system.</p>
<p>The user is responsible for checking the values returned by the read/write methods. Values less than or equal to zero indicate a closed or lost connection or the occurence of an error.</p>
<p>by Perry R. Cook and Gary P. Scavone, 1995-2012. </p>
<hr/><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" id="a0fc92fd76f406ab8eeabbeb27ba9a2fc"></a><!-- doxytag: member="stk::TcpServer::TcpServer" ref="a0fc92fd76f406ab8eeabbeb27ba9a2fc" args="(int port=2006)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">stk::TcpServer::TcpServer </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"> <em>port</em> = <code>2006</code></td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Default constructor creates a local socket server on port 2006 (or the specified port number). </p>
<p>An <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> will be thrown if a socket error occurs during instantiation. </p>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a421e255c3a250c5ac5d9e9642049cb9e"></a><!-- doxytag: member="stk::TcpServer::accept" ref="a421e255c3a250c5ac5d9e9642049cb9e" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int stk::TcpServer::accept </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Extract the first pending connection request from the queue and create a new connection, returning the descriptor for the accepted socket. </p>
<p>If no connection requests are pending and the socket has not been set non-blocking, this function will block until a connection is present. If an error occurs, -1 is returned. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="TcpServer_8h_source.html">TcpServer.h</a></li>
</ul>
</div>
<HR>
<table>
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
<tr><td>©1995-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
</table>
</BODY>
</HTML>
|