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::Receiver</title>
49  </head>
50  <body>
51<h1><CODE>nn::rdt::CTR::Receiver</CODE> Class</h1>
52<h2>Syntax</h2>
53    <div class="section">
54<pre class="definition">class Receiver</pre>
55    </div>
56<h2>Description</h2>
57    <div class="section">
58<p>Class that represents a device that receives data.</p><p>The process below shows how to use the <CODE>Receiver</CODE> class. Although the description below leaves out calls to <a href="../../../../nn/rdt/CTR/Receiver/Process.html"><CODE>Process</CODE></a>, in practice <a href="../../../../nn/rdt/CTR/Receiver/Process.html"><CODE>Process</CODE></a> must be called periodically (at least every game frame).</p><p>1. Create an instance of the <CODE>Receiver</CODE> class.</p><p>2. Call <a href="../../../../nn/rdt/CTR/Receiver/Initialize.html"><CODE>Initialize</CODE></a> to initialize the instance. (This assigns memory that the <CODE>Receiver</CODE> instance will use as working memory and receive buffer.)</p><p>3. Call <a href="../../../../nn/rdt/CTR/Receiver/Wait.html"><CODE>Wait</CODE></a> to wait for a <CODE>Sender</CODE> instance to connect.</p><p>4. Once the state transitions to <CODE>RECEIVER_STATE_OPENED</CODE>, call <a href="../../../../nn/rdt/CTR/Receiver/Receive.html"><CODE>Receive</CODE></a> periodically. As data arrives, write it to a region that has been prepared by the application.</p><p>5. Once the state transitions to <CODE>RECEIVER_STATE_FINISHED</CODE>, confirm that the data size readable by <a href="../../../../nn/rdt/CTR/Receiver/Receive.html"><CODE>Receive</CODE></a> is now zero. Then call <a href="../../../../nn/rdt/CTR/Receiver/Close.html"><CODE>Close</CODE></a>.</p><p>6. Once the state transitions to <CODE>RECEIVER_STATE_CLOSED</CODE>, call <a href="../../../../nn/rdt/CTR/Sender/Finalize.html"><CODE>Finalize</CODE></a> to finalize the <CODE>Receiver</CODE> class.</p><h3> Example with Pseudo-Code </h3><pre><code>
59Receiver receiver;
60receiver.Initialize();
61receiver.Wait();
62while(receiver.GetStatus()!=RECEIVER_STATE_OPENED)
63{
64    beginFrame();
65    receiver.Process();
66    endFrame();
67}
68while(1)
69{
70    beginFrame();
71    receiver.Process();
72    receiver.Receive();
73    endFrame();
74    if(receiver.GetStatus()==RECEIVER_STATE_FINISHED)
75    {
76        if(recvSize==0)
77        {
78            break;
79        }
80    }
81}
82receiver.Close();
83while(receiver.GetStatus()!=RECEIVER_STATE_CLOSED)
84{
85    beginFrame();
86    receiver.Process();
87    endFrame();
88}
89receiver.Finalize();
90</code></pre></div>
91    <a name="constant" id="constant">
92<h2>Member Constants</h2>
93      <div class="section">
94        <table class="members">
95          <tr>
96            <td width="100">
97<span class="static_style" title="static">S</span>
98            </td>
99            <th>
100<span class="argument"><a href="../../../../nn/rdt/CTR/Receiver/RECEIVER_WORKBUF_SIZE.html"><CODE>RECEIVER_WORKBUF_SIZE</CODE></a></span>
101            </th>
102<td>Size of the working memory required by the <CODE>Receiver</CODE> instance.</td>
103          </tr> </table>
104      </div>
105    </a> <a name="function" id="function">
106<h2>Member Functions</h2>
107      <div class="section">
108        <table class="members">
109          <tr>
110            <td width="100">  </td>
111            <th>
112<a href="../../../../nn/rdt/CTR/Receiver/Receiver.html"><CODE>Receiver</CODE></a>
113            </th>
114<td>Constructor.</td>
115          </tr>
116          <tr>
117            <td width="100">  </td>
118            <th>
119<a href="../../../../nn/rdt/CTR/Receiver/~Receiver.html"><CODE>~Receiver</CODE></a>
120            </th>
121<td>Destructor.</td>
122          </tr>
123          <tr>
124            <td width="100">  </td>
125            <th>
126<a href="../../../../nn/rdt/CTR/Receiver/Initialize.html"><CODE>Initialize</CODE></a>
127            </th>
128<td>Initializes an instance.</td>
129          </tr>
130          <tr>
131            <td width="100">  </td>
132            <th>
133<a href="../../../../nn/rdt/CTR/Receiver/Finalize.html"><CODE>Finalize</CODE></a>
134            </th>
135<td>Frees resources that were used by a <CODE>Receiver</CODE> instance, including the receive buffer and the endpoint descriptor(s).</td>
136          </tr>
137          <tr>
138            <td width="100">  </td>
139            <th>
140<a href="../../../../nn/rdt/CTR/Receiver/Wait.html"><CODE>Wait</CODE></a>
141            </th>
142<td>Issues a request to wait for a connection.</td>
143          </tr>
144          <tr>
145            <td width="100">  </td>
146            <th>
147<a href="../../../../nn/rdt/CTR/Receiver/Close.html"><CODE>Close</CODE></a>
148            </th>
149<td>Issues a request to revert an instance to the <CODE>CLOSED</CODE> state.</td>
150          </tr>
151          <tr>
152            <td width="100">  </td>
153            <th>
154<a href="../../../../nn/rdt/CTR/Receiver/Receive.html"><CODE>Receive</CODE></a>
155            </th>
156<td>Reads the data that has accumulated in the receive buffer.</td>
157          </tr>
158          <tr>
159            <td width="100">  </td>
160            <th>
161<a href="../../../../nn/rdt/CTR/Receiver/Process.html"><CODE>Process</CODE></a>
162            </th>
163<td>Proceeds with communication. The actual communication takes place within this function.</td>
164          </tr>
165          <tr>
166            <td width="100">  </td>
167            <th>
168<a href="../../../../nn/rdt/CTR/Receiver/Cancel.html"><CODE>Cancel</CODE></a>
169            </th>
170<td>Cancels processing.</td>
171          </tr>
172          <tr>
173            <td width="100">  </td>
174            <th>
175<a href="../../../../nn/rdt/CTR/Receiver/GetStatus.html"><CODE>GetStatus</CODE></a>
176            </th>
177<td>Gets the status of a <CODE>Receiver</CODE> instance.</td>
178          </tr>
179          <tr>
180            <td width="100">  </td>
181            <th>
182<a href="../../../../nn/rdt/CTR/Receiver/SetPacketLossRatio.html"><CODE>SetPacketLossRatio</CODE></a>
183            </th>
184<td>Virtually sets the packet loss ratio (for debugging). This function may be removed in a future release without notice.</td>
185          </tr>
186          <tr>
187            <td width="100">  </td>
188            <th>
189<a href="../../../../nn/rdt/CTR/Receiver/PrintDebugInfo.html"><CODE>PrintDebugInfo</CODE></a>
190            </th>
191<td>Prints detailed information about the internal state of a <CODE>Receiver</CODE> instance (for debugging). This function may be removed in a future release without notice.</td>
192          </tr> </table>
193      </div>
194    </a>
195<h2>Revision History</h2>
196    <div class="section">
197      <dl class="history">
198        <dt>2011/03/16</dt>
199<dd>Inserted pseudo-code.<br />
200        </dd>
201        <dt>2010/06/14</dt>
202<dd>Initial version.<br />
203        </dd>
204      </dl>
205    </div>
206  <hr><p>CONFIDENTIAL</p></body>
207</html>
208