QuickFix/n同一端口上的多个Session

本文关键字:Session QuickFix | 更新日期: 2023-09-27 18:01:55

我应该能够在QuickFix/n中在同一端口上运行多个会话吗?

我有以下配置

[DEFAULT]
ConnectionType=acceptor
ReconnectInterval=2
FileStorePath=store
FileLogPath=fixlog
PersistMessages=N
StartTime=00:00:00
EndTime=00:00:00
LogoutTimeout=5
ResetOnLogon=Y
UseDataDictionary=Y
ValidateFieldsOutOfOrder=N
AllowUnknownMsgFields=Y
ValidateUserDefinedFields=N
ValidateFieldsHaveValues=N
AppDataDictionary=config/fix/FIX50SP2.xml
TransportDataDictionary=config/fix/FIXT11.xml
BeginString=FIXT.1.1
DefaultApplVerID=FIX.5.0SP2
HeartBtInt=30
SenderCompID=MERCURIA
SenderSubID=1
SocketAcceptPort=5011
[SESSION]
TargetCompID=CLIENT1
SocketAcceptPort=5011
TargetSubID=1
HeartBtInt=30
[SESSION]
TargetCompID=CLIENT1
SocketAcceptPort=5011
TargetSubID=2
HeartBtInt=30
[SESSION]
TargetCompID=CLIENT1
SocketAcceptPort=5011
TargetSubID=3
HeartBtInt=30

,但当我运行这个,然后登录到CLIENT 1的subId为1,我得到"一个现有的连接被远程主机强制关闭"错误。

2015-07-10 09:34:33,729 [21] INFO  Mercuria.Olympus.FixInterface.Common.Cracker.Log4NetLog [(null)] - OnEvent - FIXT.1.1:MERCURIA/1->CLIENT1/1 - Responding to logon request
2015-07-10 09:34:33,733 [21] INFO  Mercuria.Olympus.FixInterface.Common.Cracker.FixInterfaceApplication [(null)] - OnLogon Called
2015-07-10 09:34:36,069 [BackgroundTasks] DEBUG Mercuria.Olympus.Common.Core.EntityData.EntityCacheManager [(null)] - Id=Common.ExtendedProductCacheManager, SupplyRows=21249
2015-07-10 09:34:36,116 [BackgroundTasks] DEBUG Mercuria.Olympus.Common.Core.EntityData.EntityCacheManager [(null)] - EntityCacheManager Id=Common.ExtendedProductCacheManager, EntityUpdateCount=21249
2015-07-10 09:35:03,739 [21] INFO  Mercuria.Olympus.FixInterface.Common.Cracker.FixInterfaceApplication [(null)] - OUT ADMIN 8=FIXT.1.19=6835=034=249=MERCURIA50=152=20150710-08:35:03.73956=CLIENT157=110=038
2015-07-10 09:35:03,740 [21] INFO  Mercuria.Olympus.FixInterface.Common.Cracker.Log4NetLog [(null)] - OnOutgoing - FIXT.1.1:MERCURIA/1->CLIENT1/1 - 8=FIXT.1.19=6835=034=249=MERCURIA50=152=20150710-08:35:03.73956=CLIENT157=110=038
2015-07-10 09:35:04,670 [21] INFO  Mercuria.Olympus.FixInterface.Common.Cracker.Log4NetLog [(null)] - OnEvent - FIXT.1.1:MERCURIA/1->CLIENT1/1 - Session FIXT.1.1:MERCURIA/1->CLIENT1/1 disconnecting: Socket exception (127.0.0.1:47045): An existing connection was forcibly closed by the remote host
2015-07-10 09:35:04,671 [21] INFO  Mercuria.Olympus.FixInterface.Common.Cracker.FixInterfaceApplication [(null)] - OnLogout Called

如果我将会话配置更改为具有不同的发送compids,则可以正常工作,如下所示:

[SESSION]
TargetCompID=CLIENT1
SocketAcceptPort=5011
HeartBtInt=30
[SESSION]
TargetCompID=CLIENT2
SocketAcceptPort=5011
HeartBtInt=30

此配置是否有效,即在同一端口上使用具有相同comp id的多个会话,仅由发送者/目标SUbId不同?

谢谢,尼克

QuickFix/n同一端口上的多个Session

接受器可以接受同一端口上的多个连接,但它们必须具有唯一的targetcompid。

您需要一个唯一的会话id

最简单的方法是在每个会话中更改限定符,您可以保持发送者和目标相同的方式

SessionQualifier=Fxgo2