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<title>AutoConnection</title>
8  </head>
9  <body>
10<h1><CODE><a href="../../../../nn/Overview.html">nn</a>::<a href="../../../../nn/ir/Overview.html">ir</a>::<a href="../../../../nn/ir/CTR/Overview.html">CTR</a>::<a href="../../../../nn/ir/CTR/Communicator/Overview.html">Communicator</a>::AutoConnection</CODE> Member Function</h1>
11<h2>Syntax</h2>
12    <div class="section">
13      <pre class="definition">
14static <a href="../../../../nn/Result/Overview.html">Result</a> AutoConnection();
15
16static <a href="../../../../nn/Result/Overview.html">Result</a> AutoConnection(
17     <a href="../../../../nn/fnd/TimeSpan/Overview.html">nn::fnd::TimeSpan</a> sendReplyDelay,
18     <a href="../../../../nn/fnd/TimeSpan/Overview.html">nn::fnd::TimeSpan</a> waitRequestMin,
19     <a href="../../../../nn/fnd/TimeSpan/Overview.html">nn::fnd::TimeSpan</a> waitRequestMax,
20     <a href="../../../../nn/fnd/TimeSpan/Overview.html">nn::fnd::TimeSpan</a> waitReplyMin,
21     <a href="../../../../nn/fnd/TimeSpan/Overview.html">nn::fnd::TimeSpan</a> waitReplyMax
22);
23</pre>
24    </div>
25<h2>List of Overloaded Member Functions</h2>
26    <div class="section">
27      <table class="members">
28        <tr>
29          <td>
30<a href="./AutoConnection(0).html"><CODE>AutoConnection( )</CODE> </a>
31          </td>
32<td>Tries to make an authenticated connection.</td>
33        </tr>
34        <tr>
35          <td>
36<a href="./AutoConnection(1).html"><CODE>AutoConnection(nn::fnd::TimeSpan, nn::fnd::TimeSpan, nn::fnd::TimeSpan, nn::fnd::TimeSpan, nn::fnd::TimeSpan)</CODE> </a>
37          </td>
38<td>Tries to make an authenticated connection.</td>
39        </tr> </table>
40    </div>
41<h2>Description of <CODE>AutoConnection( )</CODE></h2>
42<div class="section"><p>This function returns control before the connection is made.</p><p>This function repeatedly executes the processes described for the <CODE>WaitConnection</CODE> and <CODE>RequireConnection</CODE> functions while randomly changing the amount of time to wait for a connection request and the amount of time to wait after a request has been sent for a connection reply. These operations are repeated in an attempt to connect to a peer that is performing the same <CODE>AutoConnection</CODE> operations on its side.</p><p>The function runs repeatedly until a connection has been made. If you want to abort the process, therefore, call the <CODE>Disconnect</CODE> function.</p><p>If the connection succeeds, this is signaled by the event returned by the <CODE>GetConnectionStatusEvent</CODE> function. </p><p>Use <CODE>GetConnectionRole</CODE> to determine whether you sent the connection request, or received it when the connection was established.</p><p>The ranges that define the minimum and maximum times to wait for connection requests and connection replies are defined by <CODE>DEFAULT_WAIT_REQUEST_MIN</CODE>, <CODE>DEFAULT_WAIT_REQUEST_MAX</CODE>,  <CODE>DEFAULT_WAIT_REPLY_MIN</CODE> and <CODE>DEFAULT_WAIT_REPLY_MAX</CODE>. The amount of time to delay before making a connection reply is defined by <CODE>DEFAULT_SEND_REPLY_DELAY</CODE>.</p><p>The system always waits after connection authentication. If data has been provided by the <CODE>Send</CODE> function, the system sends the data packets after it has received all incoming data and then waits again.</p><p>If the size of the region used to save incoming and outgoing packets&mdash;as passed to the <CODE>Initialize</CODE> function&mdash;is smaller than that defined by <CODE>NECESSARY_BUFFER_SIZE_FOR_CONNECTION</CODE> or if the size of the region used to manage packets is smaller than <CODE>GetManagementSize(1)</CODE>, the connection cannot be authenticated and this function fails.</p><!-- write here --></div>
43<h2>Description of <CODE>AutoConnection(nn::fnd::TimeSpan, nn::fnd::TimeSpan, nn::fnd::TimeSpan, nn::fnd::TimeSpan, nn::fnd::TimeSpan)</CODE></h2>
44<div class="section"><p>This function can specify ranges of minimum and maximum times to wait for connection requests and connection replies. It can also specify an amount of time to delay before sending a connection reply.</p><p>When specifying the amount of time to wait for a connection request, specify a value that is larger than the time it takes to receive <CODE>CONNECTION_REQUEST_PACKET_SIZE</CODE> of data at the current baud rate. If you specify a time shorter than this, the system may time out before the connection request packet has been received and the connection will not be accepted.</p><p>For the same reason, when specifying the amount of time to wait for a connection request, specify a value that is larger than the time it takes to receive <CODE>CONNECTION_REPLY_PACKET_SIZE</CODE> of data. </p><p>If you specify a small value, such as <CODE>0</CODE>, for the wait time, the processing load will be very large. Do not unintentionally specify a small value. </p><!-- write here --></div>
45  <hr><p>CONFIDENTIAL</p></body>
46</html>