mirror of
https://github.com/thestk/stk
synced 2026-01-14 13:31:53 +00:00
136 lines
8.5 KiB
HTML
136 lines
8.5 KiB
HTML
<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.5.8 -->
|
|
<div class="navpath"><a class="el" href="namespacestk.html">stk</a>::<a class="el" href="classstk_1_1TcpClient.html">TcpClient</a>
|
|
</div>
|
|
<div class="contents">
|
|
<h1>stk::TcpClient Class Reference</h1><!-- doxytag: class="stk::TcpClient" --><!-- doxytag: inherits="stk::Socket" -->STK TCP socket client class.
|
|
<a href="#_details">More...</a>
|
|
<p>
|
|
<code>#include <<a class="el" href="TcpClient_8h-source.html">TcpClient.h</a>></code>
|
|
<p>
|
|
<div class="dynheader">
|
|
Inheritance diagram for stk::TcpClient:</div>
|
|
<div class="dynsection">
|
|
|
|
<p><center><img src="classstk_1_1TcpClient.png" usemap="#stk::TcpClient_map" border="0" alt=""></center>
|
|
<map name="stk::TcpClient_map">
|
|
<area href="classstk_1_1Socket.html" alt="stk::Socket" shape="rect" coords="0,56,86,80">
|
|
<area href="classstk_1_1Stk.html" alt="stk::Stk" shape="rect" coords="0,0,86,24">
|
|
</map>
|
|
</div>
|
|
|
|
<p>
|
|
<a href="classstk_1_1TcpClient-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
|
|
<tr><td></td></tr>
|
|
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1TcpClient.html#1e1e2cf0981774147d516efcaf12e786">TcpClient</a> (int port, std::string hostname="localhost")</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Default class constructor creates a socket client connection to the specified host and port. <a href="#1e1e2cf0981774147d516efcaf12e786"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="e4d515e14471f5d65730c6ccccb6f653"></a><!-- doxytag: member="stk::TcpClient::~TcpClient" ref="e4d515e14471f5d65730c6ccccb6f653" args="()" -->
|
|
</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1TcpClient.html#e4d515e14471f5d65730c6ccccb6f653">~TcpClient</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" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1TcpClient.html#46ff34075ef3a0342c396af5fe1aedda">connect</a> (int port, std::string hostname="localhost")</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Connect the socket client to the specified host and port and returns the resulting socket descriptor. <a href="#46ff34075ef3a0342c396af5fe1aedda"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="f101788bd77c2026cc3ade330caf7fc5"></a><!-- doxytag: member="stk::TcpClient::writeBuffer" ref="f101788bd77c2026cc3ade330caf7fc5" args="(const void *buffer, long bufferSize, int flags=0)" -->
|
|
int </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1TcpClient.html#f101788bd77c2026cc3ade330caf7fc5">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" nowrap align="right" valign="top"><a class="anchor" name="f0c6f44c9f3d3812a7d0cb79f94eba5f"></a><!-- doxytag: member="stk::TcpClient::readBuffer" ref="f0c6f44c9f3d3812a7d0cb79f94eba5f" args="(void *buffer, long bufferSize, int flags=0)" -->
|
|
int </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1TcpClient.html#f0c6f44c9f3d3812a7d0cb79f94eba5f">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>
|
|
STK TCP socket client class.
|
|
<p>
|
|
This class provides a uniform cross-platform TCP socket client interface. Methods are provided for reading or writing data buffers to/from connections.<p>
|
|
TCP sockets are reliable and connection-oriented. A TCP socket client must be connected to a TCP server 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>
|
|
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>
|
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2009. <hr><h2>Constructor & Destructor Documentation</h2>
|
|
<a class="anchor" name="1e1e2cf0981774147d516efcaf12e786"></a><!-- doxytag: member="stk::TcpClient::TcpClient" ref="1e1e2cf0981774147d516efcaf12e786" args="(int port, std::string hostname="localhost")" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">stk::TcpClient::TcpClient </td>
|
|
<td>(</td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"> <em>port</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">std::string </td>
|
|
<td class="paramname"> <em>hostname</em> = <code>"localhost"</code></td><td> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>
|
|
Default class constructor creates a socket client connection to the specified host and port.
|
|
<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.
|
|
</div>
|
|
</div><p>
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<a class="anchor" name="46ff34075ef3a0342c396af5fe1aedda"></a><!-- doxytag: member="stk::TcpClient::connect" ref="46ff34075ef3a0342c396af5fe1aedda" args="(int port, std::string hostname="localhost")" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int stk::TcpClient::connect </td>
|
|
<td>(</td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"> <em>port</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">std::string </td>
|
|
<td class="paramname"> <em>hostname</em> = <code>"localhost"</code></td><td> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>
|
|
Connect the socket client to the specified host and port and returns the resulting socket descriptor.
|
|
<p>
|
|
If the socket client is already connected, that connection is terminated and a new connection is attempted. An <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> will be thrown if a socket error occurs.
|
|
</div>
|
|
</div><p>
|
|
<hr>The documentation for this class was generated from the following file:<ul>
|
|
<li><a class="el" href="TcpClient_8h-source.html">TcpClient.h</a></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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
|
</table>
|
|
|
|
</BODY>
|
|
</HTML>
|