QuickFIX / n未连接

时间:2013-04-08 15:41:22

标签: c# quickfix

我有一个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

1 个答案:

答案 0 :(得分:0)

检查以下两行:

entry.SetString("StartTime", "23:59:59");
entry.SetString("EndTime", "23:59:59");

我想这就是你可能面临问题的原因。启动器只能在StartTime启动。 您的客户可能会在其他时间启动它吗?