Connecting to Multiple Segments
Handler instance allows us to connect to a single segment only. To connect to multiple segments, there is a need to create one handler instance for each segment. Please see the MultiSegment Sample from the installation package.
Note
Segment id is specified as session TargetSubID. SenderCompId and SenderSubId will be the same for all segments.
Example
Following example demonstrates how to connect to multiple segments:
Handler handler1 = new Handler("SenderCompId", "SenderSubId", "Segment1");
handler1.ExecutionReportReceived += new EventHandler<MessageEventArgs>(handler_ExecutionReportReceived);
handler1.MassOrderCancelReportReceived += new EventHandler<MessageEventArgs>(handler_MassOrderCancelReportReceived);
// Same SenderCompId and SenderSubId, but different TargetSubID
Handler handler2 = new Handler("SenderCompId", "SenderSubId", "Segment2");
handler2.ExecutionReportReceived += new EventHandler<MessageEventArgs>(handler_ExecutionReportReceived);
handler2.MassOrderCancelReportReceived += new EventHandler<MessageEventArgs>(handler_MassOrderCancelReportReceived);
handler1.Logon(host1, port1, accessKey, secretKey);
handler2.Logon(host2, port2, accessKey, secretKey);