在QF事件日志中有会话层的活动:
20180418-13:30:51.268 : Connection failed: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond #.#.#.#:#
20180418-13:31:00.288 : Connecting to #.#.#.# on port #
20180418-13:31:21.293 : Connection failed: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond #.#.#.#:#
20180418-13:31:00.288 : Connecting to #.#.#.# on port #
什么是事件处理程序使用报告/应对这些事件?该OnLogout
处理程序不会被调用。
我不希望使用FromEarlyIntercept
,我猜会赶上的事件?
此行为是设计 - 没有建立连接,无登录完成的,所以在连接时网络出现故障后没有OnLogout
事件。你可以看到源代码的一部分 - FromEarlyIntercept
也不会在这种情况下触发。的QuickFix / N只是记录错误,并会尝试ReconnectInterval
秒后重新连接。
try
{
t.Connect();
t.Initiator.SetConnected(t.Session.SessionID);
t.Session.Log.OnEvent("Connection succeeded");
t.Session.Next();
while (t.Read())
{ }
if (t.Initiator.IsStopped)
t.Initiator.RemoveThread(t);
t.Initiator.SetDisconnected(t.Session.SessionID);
}
catch (IOException ex) // Can be exception when connecting, during ssl authentication or when reading
{
t.Session.Log.OnEvent("Connection failed: " + ex.Message);
}
catch (SocketException e)
{
t.Session.Log.OnEvent("Connection failed: " + e.Message);
}