qBool StartNATSession( CallContext * cc );
Name | Description | |
---|---|---|
in | cc | Call context. |
Value | Description |
---|---|
true |
The call to the asynchronous process was successful. |
false |
Call to asynchronous process failed (for example, because no NATTraversalClient is bound). |
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.
RootTransport::SetNameResolveThreadPriority
, RootTransport::GetNameResolveThreadPriority
RootTransport::SetNameResolveThreadCoreNo
, RootTransport::GetNameResolveThreadCoreNo
QRESULT_SUCCESS
and QRESULT_ERROR
return values to QSUCCESS
and QERROR
.
CallContext::GetOutcome
.
RootTransport::SetUpDefaultNATCheckServer
function.Scheduler::Dispatch
function may block for much longer than the specified timeout period during asynchronous processing.CONFIDENTIAL