我有一个提供给客户的 QuickFIX/n 实现。它连接到 Currenex RFQ 系统。他们偶尔在启动应用程序时遇到问题。没有错误被抛出,它在我的测试中运行良好。他们成功连接的唯一方法是重新启动整个服务器。
我不知道为什么会发生这种情况并且它没有引发任何错误。我的整个修复连接都包含在 try|catch 语句中,所以我不知道我还可能缺少什么。下面是我的连接方法。代码执行并命中所有日志记录,但永远不会发送登录消息。
我不知所措,我们的客户也是如此,任何指示都会有很大的帮助。
代码:
public void Connect()
{
try
{
string beginString = "FIX.4.2";
MemoryStoreFactory storeFactory = new MemoryStoreFactory();
MessageStoreFactory msgFactory;
LogFactory logfactory;
SessionSettings settings = new SessionSettings();
QuickFix.Dictionary entry = new QuickFix.Dictionary();
entry.SetString("ConnectionType", "initiator");
entry.SetString("ReconnectInterval", "1");
entry.SetString("SocketConnectHost", this.fixHost);
entry.SetString("FileLogPath", this.workingDirectory + "logs");
entry.SetString("FileStorePath", this.workingDirectory + "logs");
entry.SetString("StartTime", "23:59:59");
entry.SetString("EndTime", "23:59:59");
entry.SetString("HeartBtInt", "30");
entry.SetString("SocketNodelay", "Y");
//entry.SetString("SocketTrafficClass", "IPTOS_LOWDELAY");
entry.SetString("ResetSeqNumFlag", "Y");
//entry.SetString("UseDataDictionary", "N");
entry.SetString("DataDictionary", this.workingDirectory + "FixResourceFiles\\FIX42.xml");
entry.SetString("ResetOnLogout", "Y");
entry.SetString("ResetOnDisconnect", "Y");
entry.SetString("CheckLatency", "N");
entry.SetString("SocketConnectPort", this.fixPort);
this.sessionId = new QuickFix.SessionID(beginString, this.senderCompId, this.targetCompId, DateTime.Now.ToString("yyyyMMddhhmmssfff"));
settings.Set(this.sessionId, entry);
if (this.storeAllQuickFixMsgs)
{
logfactory = new FileLogFactory(settings);
}
else
{
logfactory = new ScreenLogFactory(settings);
}
msgFactory = new FileStoreFactory(settings);
Logger.MsgLog("Creating QuickFIX Socket Initiator...");
QuickFix.Transport.SocketInitiator init = new QuickFix.Transport.SocketInitiator(this, msgFactory, settings);
//this.socketInitiator = new QuickFix.Transport.SocketInitiator(this, msgFactory, settings, logfactory);
this.socketInitiator = init;
Logger.MsgLog("Starting Socket Initiator...");
this.socketInitiator.Start();
Logger.MsgLog("Started");
}
catch (Exception ex)
{
Logger.MsgLog("Error on FIX Connection: " + ex);
}
}
设置:(内部企业FIX主机)CNX i1scfxcrfq 10.192.6.121 444 test1234