mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
66 lines
6.3 KiB
HTML
66 lines
6.3 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.6.2 -->
|
|
<div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.html">include</a>
|
|
</div>
|
|
<div class="contents">
|
|
<h1>UdpSocket.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_UDPSOCKET_H</span>
|
|
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_UDPSOCKET_H</span>
|
|
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
|
<a name="l00004"></a>00004 <span class="preprocessor">#include "Socket.h"</span>
|
|
<a name="l00005"></a>00005
|
|
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
|
<a name="l00007"></a>00007
|
|
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
|
<a name="l00029"></a>00029 <span class="comment">/***************************************************/</span>
|
|
<a name="l00030"></a>00030
|
|
<a name="l00031"></a><a class="code" href="classstk_1_1UdpSocket.html">00031</a> <span class="keyword">class </span><a class="code" href="classstk_1_1UdpSocket.html" title="STK UDP socket server/client class.">UdpSocket</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Socket.html" title="STK internet socket abstract base class.">Socket</a>
|
|
<a name="l00032"></a>00032 {
|
|
<a name="l00033"></a>00033 <span class="keyword">public</span>:
|
|
<a name="l00035"></a>00035
|
|
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1UdpSocket.html#aaad5171c74b4ab7c2155cd63ef30a271" title="Default constructor creates a local UDP socket on port 2006 (or the specified port...">UdpSocket</a>( <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Socket.html#abe3040ecfff6ce921284c6ab4b0500a7" title="Return the socket port number.">port</a> = 2006 );
|
|
<a name="l00039"></a>00039
|
|
<a name="l00041"></a>00041 <a class="code" href="classstk_1_1UdpSocket.html#a9b54f5d058c01c04dc266f117da7ee2a" title="The class destructor closes the socket instance.">~UdpSocket</a>();
|
|
<a name="l00042"></a>00042
|
|
<a name="l00044"></a>00044
|
|
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1UdpSocket.html#a4267442661257aae2a0f6b48d367fea1" title="Set the address for subsequent outgoing data sent via the writeBuffer() function...">setDestination</a>( <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Socket.html#abe3040ecfff6ce921284c6ab4b0500a7" title="Return the socket port number.">port</a> = 2006, std::string hostname = <span class="stringliteral">"localhost"</span> );
|
|
<a name="l00048"></a>00048
|
|
<a name="l00050"></a>00050
|
|
<a name="l00053"></a>00053 <span class="keywordtype">int</span> <a class="code" href="classstk_1_1UdpSocket.html#aa9d3d734b4e9c811724eff626e849cb8" title="Send a buffer to the address specified with the setDestination() function. Returns...">writeBuffer</a>(<span class="keyword">const</span> <span class="keywordtype">void</span> *buffer, <span class="keywordtype">long</span> bufferSize, <span class="keywordtype">int</span> flags = 0);
|
|
<a name="l00054"></a>00054
|
|
<a name="l00056"></a>00056 <span class="keywordtype">int</span> <a class="code" href="classstk_1_1UdpSocket.html#a1f66fdcc40b07f9d56e472be9684adcb" title="Read an input buffer, up to length bufferSize. Returns the number of bytes read or...">readBuffer</a>(<span class="keywordtype">void</span> *buffer, <span class="keywordtype">long</span> bufferSize, <span class="keywordtype">int</span> flags = 0);
|
|
<a name="l00057"></a>00057
|
|
<a name="l00059"></a>00059 <span class="keywordtype">int</span> <a class="code" href="classstk_1_1UdpSocket.html#a85f74161d2d3697593f08bda9dcb8963" title="Write a buffer to the specified socket. Returns the number of bytes written or -1...">writeBufferTo</a>(<span class="keyword">const</span> <span class="keywordtype">void</span> *buffer, <span class="keywordtype">long</span> bufferSize, <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Socket.html#abe3040ecfff6ce921284c6ab4b0500a7" title="Return the socket port number.">port</a>, std::string hostname = <span class="stringliteral">"localhost"</span>, <span class="keywordtype">int</span> flags = 0 );
|
|
<a name="l00060"></a>00060
|
|
<a name="l00061"></a>00061 <span class="keyword">protected</span>:
|
|
<a name="l00062"></a>00062
|
|
<a name="l00064"></a>00064
|
|
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1UdpSocket.html#a785594fd882b76d4c280b72a016f026d" title="A protected function for use in writing a socket address structure.">setAddress</a>( <span class="keyword">struct</span> sockaddr_in *address, <span class="keywordtype">int</span> port = 2006, std::string hostname = <span class="stringliteral">"localhost"</span> );
|
|
<a name="l00068"></a>00068
|
|
<a name="l00069"></a>00069 <span class="keyword">struct </span>sockaddr_in address_;
|
|
<a name="l00070"></a>00070 <span class="keywordtype">bool</span> validAddress_;
|
|
<a name="l00071"></a>00071
|
|
<a name="l00072"></a>00072 };
|
|
<a name="l00073"></a>00073
|
|
<a name="l00074"></a>00074 } <span class="comment">// stk namespace</span>
|
|
<a name="l00075"></a>00075
|
|
<a name="l00076"></a>00076 <span class="preprocessor">#endif</span>
|
|
</pre></div></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>
|