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><a href="../../../../nn/Overview.html">nn</a>::<a href="../../../../nn/rdt/Overview.html">rdt</a>::<a href="../../../../nn/rdt/CTR/Overview.html">CTR</a>::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 width="100">const size_t</td> 103<td>Size of the working memory required by the <CODE>Receiver</CODE> instance.</td> 104 </tr> </table> 105 </div> 106 </a> <a name="function" id="function"> 107<h2>Member Functions</h2> 108 <div class="section"> 109 <table class="members"> 110 <tr> 111 <td width="100"> </td> 112 <th> 113<a href="../../../../nn/rdt/CTR/Receiver/Receiver.html"><CODE>Receiver</CODE></a> 114 </th> 115<td>Constructor.</td> 116 </tr> 117 <tr> 118 <td width="100"> </td> 119 <th> 120<a href="../../../../nn/rdt/CTR/Receiver/~Receiver.html"><CODE>~Receiver</CODE></a> 121 </th> 122<td>Destructor.</td> 123 </tr> 124 <tr> 125 <td width="100"> </td> 126 <th> 127<a href="../../../../nn/rdt/CTR/Receiver/Initialize.html"><CODE>Initialize</CODE></a> 128 </th> 129<td>Initializes an instance.</td> 130 </tr> 131 <tr> 132 <td width="100"> </td> 133 <th> 134<a href="../../../../nn/rdt/CTR/Receiver/Finalize.html"><CODE>Finalize</CODE></a> 135 </th> 136<td>Frees resources that were used by a <CODE>Receiver</CODE> instance, including the receive buffer and the endpoint descriptor(s).</td> 137 </tr> 138 <tr> 139 <td width="100"> </td> 140 <th> 141<a href="../../../../nn/rdt/CTR/Receiver/Wait.html"><CODE>Wait</CODE></a> 142 </th> 143<td>Issues a request to wait for a connection.</td> 144 </tr> 145 <tr> 146 <td width="100"> </td> 147 <th> 148<a href="../../../../nn/rdt/CTR/Receiver/Close.html"><CODE>Close</CODE></a> 149 </th> 150<td>Issues a request to revert an instance to the <CODE>CLOSED</CODE> state.</td> 151 </tr> 152 <tr> 153 <td width="100"> </td> 154 <th> 155<a href="../../../../nn/rdt/CTR/Receiver/Receive.html"><CODE>Receive</CODE></a> 156 </th> 157<td>Reads the data that has accumulated in the receive buffer.</td> 158 </tr> 159 <tr> 160 <td width="100"> </td> 161 <th> 162<a href="../../../../nn/rdt/CTR/Receiver/Process.html"><CODE>Process</CODE></a> 163 </th> 164<td>Proceeds with communication. The actual communication takes place within this function.</td> 165 </tr> 166 <tr> 167 <td width="100"> </td> 168 <th> 169<a href="../../../../nn/rdt/CTR/Receiver/Cancel.html"><CODE>Cancel</CODE></a> 170 </th> 171<td>Cancels processing.</td> 172 </tr> 173 <tr> 174 <td width="100"> </td> 175 <th> 176<a href="../../../../nn/rdt/CTR/Receiver/GetStatus.html"><CODE>GetStatus</CODE></a> 177 </th> 178<td>Gets the status of a <CODE>Receiver</CODE> instance.</td> 179 </tr> 180 <tr> 181 <td width="100"> </td> 182 <th> 183<a href="../../../../nn/rdt/CTR/Receiver/SetPacketLossRatio.html"><CODE>SetPacketLossRatio</CODE></a> 184 </th> 185<td>Virtually sets the packet loss ratio (for debugging). This function may be removed in a future release without notice.</td> 186 </tr> 187 <tr> 188 <td width="100"> </td> 189 <th> 190<a href="../../../../nn/rdt/CTR/Receiver/PrintDebugInfo.html"><CODE>PrintDebugInfo</CODE></a> 191 </th> 192<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> 193 </tr> </table> 194 </div> 195 </a> 196<h2>Revision History</h2> 197 <div class="section"> 198 <dl class="history"> 199 <dt>2011/03/16</dt> 200<dd>Inserted pseudo-code.<br /> 201 </dd> 202 <dt>2010/06/14</dt> 203<dd>Initial version.<br /> 204 </dd> 205 </dl> 206 </div> 207 <hr><p>CONFIDENTIAL</p></body> 208</html> 209