OnixS C++ CME iLink 3 Binary Order Entry Handler  1.18.0
API Documentation
ExternalThread Mode

Sometimes, it is more effective to perform the event dispatching in a loop in the main application thread. For this purpose, one can use the OnixS::CME::iLink3::ThreadingModel::External mode.

Stack

Before an externally-managed session is created, the application must create an OnixS::CME::iLink3::SessionReactor instance. There are two reactor classes, which can be used:

TcpStandardStack tcpStandardStack;

The reference to the stack is provided in Session's constructor, for example:

Session session(tcpStandardStack, settings, marketSegmentId, &listener, storageType);

Asynchronous Connect and Disconnect

Applications must call asynchronous Session's methods to connect (OnixS::CME::iLink3::Session::connectAsync) and disconnect (OnixS::CME::iLink3::Session::disconnectAsync).

session.connectAsync(host, port);
// Dispatching events..
session.disconnectAsync("End of connection");

Dispatching Network Events

Applications must call OnixS::CME::iLink3::TcpStandardStack::dispatchEvents frequently for each stack that is in use.

bool finished = false;
while (!finished)
tcpStandardStack.dispatchEvents();

Shutdown

The TCPStandard stack requires finishing all outstanding work and handling all outstanding events. Before destroying the OnixS::CME::iLink3::TcpStandardStack instance, the following code should be executed:

while (!tcpStandardStack.isQuiescent())
tcpStandardStack.dispatchEvents();

Method OnixS::CME::iLink3::TcpStandardStack::isQuiescent returns a boolean value indicating whether a stack is quiescent.

This can be used to ensure that all connections have been closed gracefully before destroying a stack (or exiting the application). Destroying a stack while it is not quiescent is permitted by the API, but when doing so there is no guarantee that sent data has been acknowledged by the peer or even transmitted, and there is the possibility that peers' connections will be reset.

See also