1<html>
2
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css">
6
7<title>MPSend</title>
8</head>
9
10<body>
11<h1>MPSend</h1>
12
13<h2>C Specification</h2>
14<p>
15<dl>
16  <dd><pre><code>#include &lt;revolution/mp.h&gt;</code></pre>
17  </dd>
18  <dd><pre><code>s32 MPSend ( const void* <i><b>data</b></i>, u32 <i><b>length</b></i>, u32 <i><b>aidBits</b></i>, u32 <i><b>port</b></i>, u32* <i><b>restBits</b></i> );</code></pre>
19  </dd>
20</dl>
21</p>
22
23<h2>Arguments</h2>
24<p>
25<table border="1">
26  <tr>
27<td valign="top" width="120" bgcolor="#ffffe8"><code><strong><em>data</em></strong></code></td>
28<td width="520">Pointer to the data to be sent</td>
29  </tr>
30  <tr>
31<td valign="top" width="120" bgcolor="#ffffe8"><code><strong><em>length</em></strong></code></td>
32<td width="520">Length of the data to be sent</td>
33  </tr>
34  <tr>
35<td valign="top" width="120" bgcolor="#ffffe8"><code><strong><em>aidBits</em></strong></code></td>
36<td width="520">AID list of the send destinations</td>
37  </tr>
38  <tr>
39<td valign="top" width="120" bgcolor="#ffffe8"><code><strong><em>port</em></strong></code></td>
40<td width="520">Port number that is sending the data</td>
41  </tr>
42  <tr>
43<td valign="top" width="120" bgcolor="#ffffe8"><code><strong><em>restBits</em></strong></code></td>
44<td width="520">List of AIDs that need resends</td>
45  </tr>
46</table>
47</p>
48
49<h2>Return Values</h2>
50
51<P>Returns the processing results. Returns a negative number if processing fails.</P>
52
53<h2>Description</h2>
54
55<p>This function is used to send data. Blocking occurs until an attempt is made to send the Send Data. The results are stored in <CODE>*restBits</CODE> and returned.<br>Since <CODE>MP_RESULT_OK</CODE> is the return value even if the send attempt fails, be sure to determine whether or not data has been sent to all destinations based on whether or not <CODE>restBits</CODE> is 0. </p>
56<p>The <CODE>restBits</CODE> bit is sometimes set even if sending succeeded. Conversely, if communications fail, the <CODE>restBits</CODE> bit is supposed to be set for certain, but if more than eight children are connected to the Wii there is no guarantee for this either. When a number of children are connected, you will need at times to confirm the arrival of data at the application level.</p>
57<p>The value of restBits indicates any parties that must be resent to. Specifically, of the parties specified by <CODE>aidBits</CODE>, the corresponding bits of <CODE>restBits</CODE> are not set for those parties that are not connected or that were disconnected during communications. The reason for this is that resending to a disconnected party is pointless. Be sure to check whether other parties have been disconnected using a separate disconnect notification. Under MP communications, there is no guarantee that data sent immediately before a disconnect actually reaches the destination party.<br>When a connection notification arrives, set the <CODE>aidBits</CODE> to be sent to as part of the registration process conducted by the application, and when a disconnect notification arrives, perform removal processing and clear the bit in <CODE>aidBits</CODE>. Then, when sending data, decide whether to resend by looking at <CODE>restBits</CODE>. In the case of disconnected children, perform processing after reconnection (if necessary) under the assumption that data sent immediately before a disconnect may not have arrived. This is the basic design concept behind MP communications. Note that zero is always returned in <CODE>restBits</CODE> whenever a child is completely unconnected as a special case of the above.</p>
58<p>The <CODE>port</CODE> number can be set to numbers 5 through 8 for raw communications and numbers 12 through 15 for sequential communications by the application.</p>
59<p><font color="red">For sequential communications, the properties are only guaranteed for connections of up to eight children. </font>Connections of more than eight children are not guaranteed to have the sequential communications' advantage that successfully sent data always reaches its target.</p>
60
61<h2>See Also</h2>
62<p>
63<code><a href="./MPSendAsync.html">MPSendAsync()</a></code>, <code><a href="./MPError.html">MPError</a></code>
64</p>
65
66<h2>Revision History</h2>
67
68<p>
692007/09/26  Changed the explanation about sequential communications.<br>2007/01/29 Added a description of <CODE>restBits</CODE>.<br>2006/08/22 Added a description of <CODE>restBits</CODE>.<br>2006/06/29 Initial version.
70</p>
71
72<hr><p>CONFIDENTIAL</p></body>
73</html>