nn::nex::ConnectivityManager::StartNATSession Member Function

Syntax

qBool StartNATSession(
     CallContext * cc
);

Parameters

Name Description
in cc Call context.

Return Values



Value Description
true The call to the asynchronous process was successful.
false Call to asynchronous process failed (for example, because no NATTraversalClient is bound).

Description

Starts a NAT session.

Starts a NAT session and performs the necessary preprocessing for Internet P2P communication.

When you plan to conduct Internet P2P communication, you must run this function before creating the NetZ object. Note that the port number used for P2P communication changes every time this function executes.

The name resolution process by the NAT type determination server DNS is performed in a separate thread only when called for the first time after creating the NgsFacade object. If the router WAN side cable is unplugged before name resolution, it may take 30 or more seconds for this asynchronous process to complete because of waiting for the name resolution process timeout. Also, because name resolution cannot be canceled, it takes 30 or more seconds if terminating NEX with address resolution in a state of non-completion after the StartNATSession function.

To get asynchronous processing results, use the CallContext::GetOutcome function. The following values can be obtained.

QSUCCESS(Core, Success): Success.
QERROR(Transport, DnsError): DNS timeout.
QERROR(Transport, NatCheckError): NAT check error.
QERROR(Transport, NatTraversalError): Other error.

See Also

RootTransport::SetNameResolveThreadPriority, RootTransport::GetNameResolveThreadPriority
RootTransport::SetNameResolveThreadCoreNo, RootTransport::GetNameResolveThreadCoreNo

Revision History

2014/04/16
Changed the notation of the QRESULT_SUCCESS and QRESULT_ERROR return values to QSUCCESS and QERROR.
2013/07/31
Updated the description of the values obtained with CallContext::GetOutcome.
2012/11/07
Described that a separate thread is used for name resolution.
2012/09/25
Added information about the RootTransport::SetUpDefaultNATCheckServer function.
2012/08/08
Added that the Scheduler::Dispatch function may block for much longer than the specified timeout period during asynchronous processing.
2012/01/26
Initial version.

CONFIDENTIAL