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