2. NEX Initialization and Finalization

Initialize NEX as follows.

For more information about initialization settings, see Chapter 3 Memory Management and Chapter 4 Initialization Settings (Thread Models, Exclusive Control, and Local Communication.

Warning

With NEX, you can call the nn::socket API from three threads. As a result, in NEX 3.0 and later versions, specify a value of 4 or larger for maxSessions in nn::socket::Initialize, and set a work memory of the size returned by nn::socket::GetRequiredMemorySize. 4*64 KB of memory is required. For more information, see the nn::socket::Initialize function reference.

Use the following procedure to shut down NEX.

Call nn::nex::Core::GetInstance()->SetTerminateImmediately(true) to speed up finalization during shutdown and Sleep Mode or when not connected to the network, and to make NetZ::Terminate and NgsFacade::Logout execute faster so that finalization is performed more quickly. However, because a standard disconnection network from the network is not performed, the local station sometimes appears to be disconnected from the network (from the perspective of other peers) because of a keep-alive timeout. Refrain from this technique during a standard finalization sequence. Functions that communicate with the server also fail.

To speed up the termination of the NetZ instance only, execute the NetZ::SetTerminateImmediately function.

Note

You can use the Core::SetTerminateImmediately function only when destroying an entire NEX session when shutting down or entering Sleep Mode, or when you are not connected to a network. When the Session::JoinSession or Session::CreateSession function is called successfully and a session is joined, they are forcibly terminated by an assert check and then fail.


CONFIDENTIAL