sessionfix-protocolfix8

FIX Dropcopy client implemented with C++/FIX8 . Session management and resend problem


Implemented a C++ client which establishes 8 sessions and reads from the server. The messages I process are Logon/Logoff/TradeCaptureReport and ExecutionReport.

My questions are below:

  1. Should I keep track of received message sequence numbers and detect any missing message set and do a resend request or does FIX8 library handles this in the background? E.g when client crashes or there is a network problem.

  2. While sending messages I have the code below to increase sequence number of outbound messages. When I use 1st code I receive different messages with the same sequence number(Tag34) within a single session. If I use the 2nd code(always return 1) I get nothing except logon messages.

int my_session_client::getNextSendSeqNo()
{
#if FIRST
    _next_send_seq = ++send_seqnum;

    return send_seqnum;
#else
    return 1;
#endif
}

Above function is called in several message sending functions like below:

FIX8::Message *my_session_client::generate_sequence_reset(const unsigned newseqnum, const bool gapfillflag)
{
    FIX8::Message *msg(Session::generate_sequence_reset(newseqnum, gapfillflag));
    *msg << new FIX8::Paragon::SenderSubID(sender_subid_); /// crucial step.
    msg->set_custom_seqnum(getNextSendSeqNo());

    return msg;
}
  1. What is the correct way of throwing away everything I read and start to read from the first message? I tried to logoff and then log on with LogonMsg.ResetSeqNumFlag = true && LogonMsg.Header.MsgSeqNum = 1 but it read where it left not from the beginning. Below is the logon message:
   BodyLength (9): 0
   MsgType (35):
   MsgSeqNum (34): 1
Logon ("A")
   SenderSubID (50): **
   EncryptMethod (98): 0
   HeartBtInt (108): 36000
   ResetSeqNumFlag (141): Y
   Username (553): **
   Password (554): ****
   DefaultApplVerID (1137): 9
trailer ("trailer")
   CheckSum (10):
  1. I have FIX8::Message *msg. Is there a difference between the 2 assignment statements below?
msg->set_custom_seqnum(1);
*msg->Header() << new FIX8::My::MsgSeqNum(1)

Solution

    1. No, no. Sequence numbers are managed entirely by the session. Do not try and manipulate them in your application.
    2. See above
    3. If you reset sequence numbers using the logon flag, the remote session should do its reset.
    4. Do not create and set sequence numbers that way. The session does this for you.

    /dakka