iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
In C#, treat the FIX session layer as the part of your application that manages the technical conversation with a counterparty: establishing a session, tracking message sequence numbers, checking connection liveness, and handling recovery. Keep it separate from the application layer, which carries business messages such as orders and executions. Before implementing Logon, resets, or resend behavior, confirm the session profile and bilateral rules; there is no safe universal handshake or recovery procedure to assume across profiles.
What the FIX session layer does
FIX separates technical session behavior from business-related message content. The session layer governs interaction and delivery between counterparties; the application layer defines the meaning of business messages. In a C# design, that distinction is useful both architecturally and operationally: session handling should own sequence state and liveness checks, while application handlers process business content.
Do not use “FIX Latest” as though it named a session protocol version. The FIX Latest material identified as EP284, November 2023, is an application-layer specification. Session behavior should be selected from the applicable session protocol and profile.
Recommended Free Tools
Choose the session profile before coding
The FIX Trading Community’s June 2020 session-protocol announcement describes the refactored session specification as the normative session-protocol reference and identifies FIX.4.2, FIX4, FIXT, and LFIXT profiles. It characterizes FIXT, introduced with FIX 5.0, as application-version independent. That means FIXT can separate the session protocol from the application version in use; it does not mean counterparties can choose profiles or recovery behavior independently of their agreement.
#1 Best Overall
| Profile or protocol | What is established | What to confirm |
|---|---|---|
| FIX.4.2 | Identified as a profile in the June 2020 FIX session-protocol announcement. | The applicable profile rules and the counterparty’s agreed configuration. |
| FIX4 | Identified as a profile in the June 2020 FIX session-protocol announcement. | The applicable profile rules and the counterparty’s agreed configuration. |
| FIXT | Identified as application-version independent and introduced with FIX 5.0. | The application version in use, the applicable session rules, and bilateral configuration. |
| LFIXT | Identified as a profile in the June 2020 FIX session-protocol announcement. | The applicable profile rules and the counterparty’s agreed configuration. |
| FIXP | A distinct performance-oriented session protocol; the FIX Trading Community describes recoverable, unsequenced, and idempotent modes. | Whether FIXP is the protocol actually agreed for the connection. It is not interchangeable with the FIX session behavior discussed here. |
The announcement does not establish that one profile is universally preferable. Make the profile an explicit configuration choice, and use the selected profile’s current normative specification and the counterparty’s documentation as the authority for field requirements, resets, replay, and gap fills.
Logon and sequence initialization
Logon establishes the FIX session under the chosen profile, but the available profile-level guidance does not support one exact handshake or reset procedure for every profile. Do not hard-code assumptions about required fields, reset timing, or a daily reset. Apply sequence-reset semantics only when the governing profile and bilateral configuration permit them.
Rank #2
In the C# session component, keep inbound and outbound sequence state explicit and durable according to the operational requirements of the connection. The session layer—not an individual order or execution handler—should own that state. On startup or reconnect, reconcile the local state with the peer using the agreed session rules rather than silently initializing both directions to a convenient value.
- Record which session profile and application version the connection is configured to use.
- Keep inbound and outbound sequence tracking distinct.
- Route Logon, liveness, sequence, resend, and reset handling through the session component.
- Make reset behavior a deliberate, profile-validated configuration—not an unconditional startup or calendar action.
Heartbeats and TestRequest
Heartbeat (35=0) keeps a FIX connection active during inactivity and is also sent as a response to a peer’s TestRequest (35=1). TestRequest forces a response: the sender supplies TestReqID (112), and the responding Heartbeat returns that identifier. Matching the identifier links the response to the specific liveness request.
In C#, handle TestRequest as a session event and construct the required Heartbeat response with the received TestReqID. Do not treat an ordinary periodic Heartbeat as proof that a particular TestRequest was answered unless the response carries the matching identifier.
The interval, timeout, scheduling mechanism, and reconnect policy are not universal values established here; obtain them from the selected profile and connection configuration. Keep those operational settings configurable rather than embedding assumed timings in message-processing code.
Rank #4
Sequence numbers, ResendRequest, and recovery
ResendRequest (35=2) asks the peer to retransmit messages over a requested sequence range. BeginSeqNo (7) is the first sequence number requested; EndSeqNo (16) is the last. EndSeqNo=0 means request everything from BeginSeqNo onward. The request is a recovery mechanism, not a guarantee that every requested item will be resent as its original application message.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsSequenceReset gap fills are also recognized session-protocol behavior, but they are not simply another form of ordinary message replay. When to replay a message, when a gap fill is appropriate, and how expected sequence numbers advance depend on the selected profile and agreed peer behavior. Follow those rules rather than applying a generic “resend every gap” algorithm.
Best Value
- Track the sequence state. Maintain inbound and outbound sequence state in the session layer and associate received messages with their sequence numbers.
- Detect and classify a discrepancy. When sequence handling indicates missing messages, apply the selected profile’s procedure; do not let application handlers independently alter session sequence state.
- Request the agreed range. If recovery calls for a ResendRequest, set BeginSeqNo and EndSeqNo according to the missing range and the profile’s rules. Use EndSeqNo=0 only when the intended request is open-ended from BeginSeqNo onward.
- Process replay and gap fills by profile. Handle retransmitted messages and SequenceReset gap fills according to the normative profile and bilateral rules. Do not assume they have identical effects.
- Persist and observe the result. Record the recovery decision, received sequence information, and resulting session state so that unexpected gaps or peer behavior can be diagnosed.
How to structure this in C#
Keep the implementation organized around session responsibilities rather than scattering them through order-processing code. A practical separation is:
- Session configuration: selected profile, application version where relevant, and counterparty-agreed liveness and recovery settings.
- Session state: inbound and outbound sequence state plus connection/session status.
- Session message handling: Logon, Heartbeat, TestRequest, ResendRequest, and SequenceReset processing under the selected profile.
- Application dispatch: delivery of valid business messages to order, execution, or other application handlers.
- Persistence and diagnostics: state changes and enough message context to investigate recovery, without allowing logs to become the source of truth for sequence state.
Keep wire encoding and exact message-field requirements tied to the chosen session profile; the protocol semantics above are not a substitute for a complete profile-specific message specification. Validate the implementation against the counterparty’s session documentation, especially for Logon, reset behavior, replay eligibility, and gap-fill handling.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

