nn::ir::CTR::Communicator::AutoConnection Member Function

Syntax

static Result AutoConnection();

static Result AutoConnection(
     nn::fnd::TimeSpan sendReplyDelay,
     nn::fnd::TimeSpan waitRequestMin,
     nn::fnd::TimeSpan waitRequestMax,
     nn::fnd::TimeSpan waitReplyMin,
     nn::fnd::TimeSpan waitReplyMax
);

List of Overloaded Member Functions

AutoConnection( ) Tries to make an authenticated connection.
AutoConnection(nn::fnd::TimeSpan, nn::fnd::TimeSpan, nn::fnd::TimeSpan, nn::fnd::TimeSpan, nn::fnd::TimeSpan) Tries to make an authenticated connection.

Description of AutoConnection( )

This function returns control before the connection is made.

This function repeatedly executes the processes described for the WaitConnection and RequireConnection 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 AutoConnection operations on its side.

The function runs repeatedly until a connection has been made. If you want to abort the process, therefore, call the Disconnect function.

If the connection succeeds, this is signaled by the event returned by the GetConnectionStatusEvent function.

Use GetConnectionRole to determine whether you sent the connection request, or received it when the connection was established.

The ranges that define the minimum and maximum times to wait for connection requests and connection replies are defined by DEFAULT_WAIT_REQUEST_MIN, DEFAULT_WAIT_REQUEST_MAX, DEFAULT_WAIT_REPLY_MIN and DEFAULT_WAIT_REPLY_MAX. The amount of time to delay before making a connection reply is defined by DEFAULT_SEND_REPLY_DELAY.

The system always waits after connection authentication. If data has been provided by the Send function, the system sends the data packets after it has received all incoming data and then waits again.

If the size of the region used to save incoming and outgoing packets—as passed to the Initialize function—is smaller than that defined by NECESSARY_BUFFER_SIZE_FOR_CONNECTION or if the size of the region used to manage packets is smaller than GetManagementSize(1), the connection cannot be authenticated and this function fails.

Description of AutoConnection(nn::fnd::TimeSpan, nn::fnd::TimeSpan, nn::fnd::TimeSpan, nn::fnd::TimeSpan, nn::fnd::TimeSpan)

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.

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 CONNECTION_REQUEST_PACKET_SIZE 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.

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 CONNECTION_REPLY_PACKET_SIZE of data.

If you specify a small value, such as 0, for the wait time, the processing load will be very large. Do not unintentionally specify a small value.


CONFIDENTIAL