OnixS C++ FIX Engine  4.10.1
API Documentation
Establishing FIX Connection

Establishing Connection

To establish a FIX connection as an Acceptor, the OnixS::FIX::Session::logonAsAcceptor method must be used.

To establish a FIX connection as an Initiator, the OnixS::FIX::Session::logonAsInitiator method must be used.

Closing Connection

To disconnect the session, the OnixS::FIX::Session::logout method must be used. This member implements a graceful closing of the FIX connection, as defined by the Standard.

OnixS::FIX::Session::logonAsInitiator and OnixS::FIX::Session::logout methods are blocked until the Logon/Logout response is received. These methods have a timeout during which the response should be received. This timeout is equal to the heartbeat interval (by default 30 sec) + OnixS::FIX::EngineSettings::reasonableTransmissionTime value (by default 20%) as percentage from the heartbeat interval. If the acknowledgment Logon/Logout message is not received during the timeout then the Logout message will be sent and the FIX connection will be closed.

Connection and Session Lifetime

A single FIX session can exist across multiple sequential (not concurrent) physical connections. Parties can connect and disconnect multiple times while maintaining a single FIX session. That is, once the OnixS::FIX::Session::logout method is called, FIX Connection is terminated, however, the FIX session life continues. It is possible to continue the same session later, using either OnixS::FIX::Session::logonAsAcceptor or OnixS::FIX::Session::logonAsInitiator methods again. In other words, FIX Session is comprised of one or more FIX connections.

Reconnection Facility

When a FIX session is in the active state and there are some network issues the FIX Engine will try to restore the FIX connection in accordance with OnixS::FIX::EngineSettings::reconnectAttempts and OnixS::FIX::EngineSettings::reconnectInterval settings.

Reconnection facility works for already established FIX connections. In other cases, you need to use the Sessions Scheduler component or manually handle OnixS::FIX::LinkErrorException or OnixS::FIX::TimeoutException exceptions of OnixS::FIX::Session::logonAsInitiator method and try to connect again.


using namespace OnixS::FIX;
using namespace OnixS::FIX::FIX40;
class SessionListener : public ISessionListener
void onInboundApplicationMsg(Message & message, Session *) ONIXS_FIXENGINE_OVERRIDE
// Processing incoming application-level message..
<< "Incoming application-level message: "
<< message.toString()
<< std::endl;
const std::string SenderCompId = "SenderCompID";
const std::string TargetCompId = "TargetCompID";
const std::string Host = "Localhost";
// Target port is equal to acceptor's port to create a loop back FIX session.
const int AcceptorPort = Engine::instance()->listenPort();
SessionListener listener;
Session acceptor(TargetCompId, SenderCompId, Version, &listener);
Session initiator(SenderCompId, TargetCompId, Version, &listener);
// Sends the Logon message and waits for the acknowledgment Logon.
initiator.logonAsInitiator(Host, AcceptorPort);
// Message exchanges and processing logic goes here..
// Sends the Logout message and waits for the confirming Logout.
// Frees allocated resources.