FIX Antenna ANSI C  2.18.0
 All Data Structures Variables Pages
FIX Session Acceptor

Creating FIX session acceptor

Call the following method to create a session:

B2BITS_Session B2BITS_FixEngine_CreateSession(B2BITS_Application* apApp, const char* aSenderCompID, const char* aTargetCompID,
B2BITS_FIXVersion aVer, B2BITS_SessionExtraParameters* pParam, const B2BITS_MessageStorageType storageType)

After the session is created use void B2BITS_Session_ConnectAcceptor() to connect to it as an acceptor.

For example:

// Create Application instance - FIX session observer
// init function pointers with call-back functions.
app.Process = &App_Process;
app.OnLogonEvent = &App_OnLogonEvent;
app.OnLogoutEvent = &App_OnLogoutEvent;
app.OnHeartbeatWithTestReqIDEvent = &App_OnHeartbeatWithTestReqIDEvent;
// Create FIX session instance
pSA = B2BITS_FixEngine_CreateSession(
&app,
&acceptorCtx,
"Sender",
"Target",
B2BITS_FIX44,
0,
B2BITS_transient_storageType,
B2BITS_FIX_TCP);
if(!pSA)
{
printf( "Error: %s\n", B2BITS_GetLastErrorDescription() );
return 1;
}
// establishes the session as Acceptor
B2BITS_Session_ConnectAcceptor(pSA, B2BITS_EM_NONE);
// ... - business logic
// terminates the FIX session
B2BITS_Session_Disconnect(pSA);
// it is vital to do this before the 'release' call
B2BITS_Session_RegisterApplication(pSA, NULL, NULL, 1, 0);
// releases resources
B2BITS_Session_Release(pSA);
B2BITS_FixEngine_Destroy();

Unregistered acceptors

FIX Antenna automatically creates a session acceptor when a logon message is received and the corresponding pre-created session acceptor is not found. There are two ways to control this behavior:

Reconnect

According to the FIX protocol standard it is not the acceptor's responsibility to reconnect. When a connection is unexpectedly terminated, the acceptor is moved to "Wait for logon" state persisting its state. When a correct logon is received the acceptor completes reconnection process and continues working exactly from the point of termination.

Disconnect

You can use the following method to disconnect the acceptor (the process can also be called "terminate", "delete", "close"):

aMarkAsTerminated parameter is used to set the desired state after disconnection. If it is set to "true" the acceptor tries to disconnect gracefully (i.e. execute a logout procedure). If it is set to "false" the acceptor moves to the non-gracefully terminated state.

Release

Use the B2BITS_Session_Release(B2BITS_Session sn) method to release the allocated resources.

It is vital to call B2BITS_Session_RegisterApplication(pSA, NULL, NULL, 1, 0) before calling the release method.

It is vital to call the B2BITS_Session_Release(B2BITS_Session sn) method only once for the given session.

Send message

To send outgoing application-level messages, use the B2BITS_Session_Put(B2BITS_FIXMessage msg) method.

All session level messages are send automatically when needed.