1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6    <link rel="stylesheet" href="../../../../css/manpage.css" type="text/css" />
7    <style type="text/css"><!--
8      span.static_style
9      {
10        font-size			: 8pt;
11        color				: white;
12        font-weight			: bold;
13        background			: #44f;
14        border-left			: solid 1px #aaf;
15        border-top			: solid 1px #aaf;
16        border-right		: solid 1px #00c;
17        border-bottom		: solid 1px #00c;
18        padding-left		: 2px;
19        padding-right		: 2px;
20      }
21      span.virtual_style
22      {
23        font-size			 : 8pt;
24        color				 : white;
25        font-weight			: bold;
26        background			: #0a0;
27        border-left			: solid 1px #0f0;
28        border-top			: solid 1px #0f0;
29        border-right		: solid 1px #060;
30        border-bottom		: solid 1px #060;
31        padding-left		: 2px;
32        padding-right		: 2px;
33      }
34      span.protected_style
35      {
36        font-size			 : 8pt;
37        color				 : white;
38        font-weight			: bold;
39        background			: #444;
40        border-left			: solid 1px #ccc;
41        border-top			: solid 1px #ccc;
42        border-right		: solid 1px #222;
43        border-bottom		: solid 1px #222;
44        padding-left		: 2px;
45        padding-right		: 2px;
46      }
47        --></style>
48<title>nn::rdt::CTR::Sender</title>
49  </head>
50  <body>
51<h1><CODE><a href="../../../../nn/Overview.html">nn</a>::<a href="../../../../nn/rdt/Overview.html">rdt</a>::<a href="../../../../nn/rdt/CTR/Overview.html">CTR</a>::Sender</CODE> Class</h1>
52<h2>Syntax</h2>
53    <div class="section">
54<pre class="definition">class Sender</pre>
55    </div>
56<h2>Description</h2>
57    <div class="section">
58<p>Class that represents a device that sends data.</p><p>The process below shows how to use the <CODE>Sender</CODE> class. Although the description below leaves out calls to <a href="../../../../nn/rdt/CTR/Sender/Process.html"><CODE>Process</CODE></a>, in practice <a href="../../../../nn/rdt/CTR/Sender/Process.html"><CODE>Process</CODE></a> must be called periodically (at least once every game frame).</p><p>1. Create an instance of the <CODE>Sender</CODE> class.</p><p>2. Call <a href="../../../../nn/rdt/CTR/Sender/Initialize.html"><CODE>Initialize</CODE></a> to initialize the instance. (This assigns memory that the <CODE>Sender</CODE> instance will use as working memory and send buffer.)</p><p>3. Call <a href="../../../../nn/rdt/CTR/Sender/Open.html"><CODE>Open</CODE></a> to attempt a connection to the <CODE>Receiver</CODE> instance that is running remotely.</p><p>4. Once the state transitions to <CODE>SENDER_STATE_OPENED</CODE>, break the data you want to send into small chunks and call <a href="../../../../nn/rdt/CTR/Sender/Send.html"><CODE>Send</CODE></a> repeatedly.</p><p>5. Once all the data has been sent, call <a href="../../../../nn/rdt/CTR/Sender/Close.html"><CODE>Close</CODE></a> to notify the remote party that there is no more data to be sent.</p><p>6. Once the state transitions to <CODE>SENDER_STATE_CLOSED</CODE>, call <a href="../../../../nn/rdt/CTR/Sender/Finalize.html"><CODE>Finalize</CODE></a> to finalize the <CODE>Sender</CODE> class.</p><h3> Example with Pseudo-Code </h3><pre><code>
59Sender sender;
60sender.Initialize();
61sender.Open();
62while(sender.GetStatus()!=SENDER_STATE_OPENED)
63{
64    beginFrame();
65    sender.Process;
66    endFrame();
67}
68while(!isSendDataEmpty())
69{
70    beginFrame();
71    sender.Send();
72    sender.Process();
73    endFrame();
74}
75sender.Close();
76while(sender.GetStatus()!=SENDER_STATE_CLOSED)
77{
78    beginFrame();
79    sender.Process();
80    endFrame();
81}
82sender.Finalize();
83</code></pre></div>
84    <a name="constant" id="constant">
85<h2>Member Constants</h2>
86      <div class="section">
87        <table class="members">
88          <tr>
89            <td width="100">
90<span class="static_style" title="static">S</span>
91            </td>
92            <th>
93<span class="argument"><a href="../../../../nn/rdt/CTR/Sender/SENDER_WORKBUF_SIZE.html"><CODE>SENDER_WORKBUF_SIZE</CODE></a></span>
94            </th>
95<td width="100">const size_t</td>
96<td>Size of the working memory required by the <CODE>Sender</CODE> instance.</td>
97          </tr> </table>
98      </div>
99    </a> <a name="function" id="function">
100<h2>Member Functions</h2>
101      <div class="section">
102        <table class="members">
103          <tr>
104            <td width="100">  </td>
105            <th>
106<a href="../../../../nn/rdt/CTR/Sender/Sender.html"><CODE>Sender</CODE></a>
107            </th>
108<td>Constructor.</td>
109          </tr>
110          <tr>
111            <td width="100">  </td>
112            <th>
113<a href="../../../../nn/rdt/CTR/Sender/~Sender.html"><CODE>~Sender</CODE></a>
114            </th>
115<td>Destructor.</td>
116          </tr>
117          <tr>
118            <td width="100">  </td>
119            <th>
120<a href="../../../../nn/rdt/CTR/Sender/Initialize.html"><CODE>Initialize</CODE></a>
121            </th>
122<td>Initializes an instance.</td>
123          </tr>
124          <tr>
125            <td width="100">  </td>
126            <th>
127<a href="../../../../nn/rdt/CTR/Sender/Finalize.html"><CODE>Finalize</CODE></a>
128            </th>
129<td>Frees resources that were used by a <CODE>Sender</CODE> instance, including the send buffer and the endpoint descriptor(s).</td>
130          </tr>
131          <tr>
132            <td width="100">  </td>
133            <th>
134<a href="../../../../nn/rdt/CTR/Sender/Open.html"><CODE>Open</CODE></a>
135            </th>
136<td>Issues a connection request.</td>
137          </tr>
138          <tr>
139            <td width="100">  </td>
140            <th>
141<a href="../../../../nn/rdt/CTR/Sender/Close.html"><CODE>Close</CODE></a>
142            </th>
143<td>Issues a request to close a connection.</td>
144          </tr>
145          <tr>
146            <td width="100">  </td>
147            <th>
148<a href="../../../../nn/rdt/CTR/Sender/Send.html"><CODE>Send</CODE></a>
149            </th>
150<td>Writes data to the send buffer.</td>
151          </tr>
152          <tr>
153            <td width="100">  </td>
154            <th>
155<a href="../../../../nn/rdt/CTR/Sender/Process.html"><CODE>Process</CODE></a>
156            </th>
157<td>Proceeds with communication. The actual communication takes place within this function.</td>
158          </tr>
159          <tr>
160            <td width="100">  </td>
161            <th>
162<a href="../../../../nn/rdt/CTR/Sender/Cancel.html"><CODE>Cancel</CODE></a>
163            </th>
164<td>Cancels processing.</td>
165          </tr>
166          <tr>
167            <td width="100">  </td>
168            <th>
169<a href="../../../../nn/rdt/CTR/Sender/GetStatus.html"><CODE>GetStatus</CODE></a>
170            </th>
171<td>Gets the status of a <CODE>Sender</CODE> instance.</td>
172          </tr>
173          <tr>
174            <td width="100">  </td>
175            <th>
176<a href="../../../../nn/rdt/CTR/Sender/SetPacketLossRatio.html"><CODE>SetPacketLossRatio</CODE></a>
177            </th>
178<td>Virtually sets the packet loss ratio (for debugging). This function may be removed in a future release without notice.</td>
179          </tr>
180          <tr>
181            <td width="100">  </td>
182            <th>
183<a href="../../../../nn/rdt/CTR/Sender/PrintDebugInfo.html"><CODE>PrintDebugInfo</CODE></a>
184            </th>
185<td>Prints detailed information about the internal state of a <CODE>Sender</CODE> instance (for debugging). This function may be removed in a future release without notice.</td>
186          </tr> </table>
187      </div>
188    </a>
189<h2>Revision History</h2>
190    <div class="section">
191      <dl class="history">
192        <dt>2011/03/16</dt>
193<dd>Inserted pseudo-code.<br />
194        </dd>
195        <dt>2010/06/14</dt>
196<dd>Initial version.<br />
197        </dd>
198      </dl>
199    </div>
200  <hr><p>CONFIDENTIAL</p></body>
201</html>
202