简体   繁体   English

QuickFIX / n - 启动器在登录阶段重复抛出错误

[英]QuickFIX/n - Initiator repeatedly throw errors during Logon phase

I am using the trade client application on this link below to make connection between one of my VPS server and brokers server. 我正在使用下面此链接上的交易客户端应用程序在我的一个VPS服务器和代理服务器之间建立连接。

http://www.quickfixn.org/tutorial/example-applications . http://www.quickfixn.org/tutorial/example-applications

After one week of struggle, I been able to make a connection to the broker's server finally in loosely speaking. 经过一周的奋斗,我终于可以松散地与经纪人的服务器建立联系了。

However, when I run the trade client application, at logon stage I am getting this errors: 但是,当我运行交易客户端应用程序时,在登录阶段我收到此错误:

Unable to write data to the transport connection: An existing connection was forcibly   closed by the remote host

at QuickFix.SocketInitiatorThread.ReadSome(Byte[] buffer, Int32 timeoutMilliseconds) 
in ... SoecketInitiatorThread.cs:line 170 ......

at QuickFix.SocketInitiatorThread.Read() in ... SoecketInitiatorThread.cs:line 80
......

The trade client application is keeping repeating the logon attempt, however, it keeps getting the same error message only. 交易客户端应用程序正在重复登录尝试,但是,它只会继续获取相同的错误消息。

Of course, with newbie like me on this QuickFix/n engine, I am really unable to figure out what went wrong. 当然,在这个QuickFix / n引擎上有像我这样的新手,我真的无法弄清楚出了什么问题。 One possible area of investigation I can think of is that my stunnel certificate may be invalid as I am also very new to stunnel program ( https://www.stunnel.org ). 我能想到的一个可能的调查领域是我的stunnel证书可能无效,因为我对stunnel程序也很新( https://www.stunnel.org )。 I only followed the instruction from website to configure pem certificate with broker's ip address but I am not 100% sure about its purpose though. 我只是按照网站上的说明配置了经纪人的IP地址的pem证书,但我并不是100%肯定它的目的。

Here is what I put on the "stunnel.conf" file: 这是我在“stunnel.conf”文件中添加的内容:

[FIXORDER]
client = yes
accept = external ip of VPS : port   eg.(10.160.103.65:22)
connect = broker ip address :port  eg.(102.12.124.9:444)

Here is some record of logged message from stunnel program: 以下是来自stunnel程序的记录消息的一些记录:

2014.11.26 17:23:44 LOG5[3348]: Connection reset: 0 byte(s) sent to SSL, 0 byte(s) sent to socket
2014.11.26 17:23:48 LOG5[760]: Service [FIXORDER] accepted connection from x.xx.xx.xxx:xx
2014.11.26 17:23:48 LOG5[760]: s_connect: connected xxx.x.xx.xxx:xxx
2014.11.26 17:23:48 LOG5[760]: Service [FIXORDER] connected remote server from x.xx.xxx.xxx:xxx
2014.11.26 17:23:48 LOG3[760]: SSL_connect: Peer suddenly disconnected
2014.11.26 17:23:48 LOG5[760]: Connection reset: 0 byte(s) sent to SSL, 0 byte(s) sent to socket

I built certificate using above "stunnel.conf" file using built in self certificate application. 我使用内置的自我证书应用程序使用上面的“stunnel.conf”文件构建了证书。

As you see, it is kind of complicated for newbie like me, any thought or tips on this problem will be really appreciated. 如你所见,对我这样的新手来说有点复杂,对这个问题的任何想法或提示都会非常感激。

Thanks so much in advance. 非常感谢提前。

Kind regards. 亲切的问候。

M 中号

================================================================================== Updated on 27/11/2014 ================================================== ================================更新于2014年11月27日

Here I am updating my error log from Stunnel log file after I set debug verbose high taking the suggestion from xapi1492. 在我设置debug verbose high并从xapi1492获取建议后,我正在从Stunnel日志文件更新我的错误日志。

2014.11.27 01:10:46 LOG7[944]: Service [FIXORDER] started
2014.11.27 01:10:46 LOG5[944]: Service [FIXORDER] accepted connection from x.xxx.xxx.xxx:3667
2014.11.27 01:10:46 LOG6[944]: s_connect: connecting xx.x.xx.xx:9002
2014.11.27 01:10:46 LOG7[944]: s_connect: s_poll_wait xx.x.xx.102:9002: waiting 10 seconds
2014.11.27 01:10:46 LOG5[944]: s_connect: connected xx.x.xx.xx:9002
2014.11.27 01:10:46 LOG5[944]: Service [FIXORDER] connected remote server from x.xxx.xxx.xxx:3668
2014.11.27 01:10:46 LOG7[944]: Remote socket (FD=392) initialized
2014.11.27 01:10:46 LOG6[944]: SNI: sending servername: xxx.x.xx.xx
2014.11.27 01:10:46 LOG7[944]: SSL state (connect): before/connect initialization
2014.11.27 01:10:46 LOG7[944]: SSL state (connect): SSLv2/v3 write client hello A
2014.11.27 01:10:46 LOG3[944]: SSL_connect: Peer suddenly disconnected
2014.11.27 01:10:46 LOG5[944]: Connection reset: 0 byte(s) sent to SSL, 0 byte(s) sent to socket
2014.11.27 01:10:46 LOG7[944]: Remote socket (FD=392) closed
2014.11.27 01:10:46 LOG7[944]: Local socket (FD=380) closed
2014.11.27 01:10:46 LOG7[944]: Service [FIXORDER] finished (0 left)

================================================================================== Updated on 28/11/2014 ================================================== ================================更新于2014年11月28日

Still having difficult to find answer, so I decided to provide my config file for QuickFix client application. 仍然很难找到答案,所以我决定为QuickFix客户端应用程序提供我的配置文件。

[DEFAULT]
ConnectionType=initiator
ReconnectInterval=2
FileStorePath=store
FileLogPath=fixlog
StartTime=00:00:00
EndTime=00:00:00
UseDataDictionary=Y
DataDictionary=FIX44.xml
SocketConnectHost= xxx //my vps ip address
SocketConnectPort= xxx //my vps port //specified on stunnel
ResetOnLogon=Y
ResetOnLogout=Y
ResetOnDisconnect=Y
CheckLatency=N
LogonTimeout=10


# standard config elements

[SESSION]
BeginString=FIX.4.4
SenderCompID= xxx   //my ID
Username= xxx       //my username
Password= xxx       //my password
TargetCompID=FIXORDER
HeartBtInt=30
SocketConnectHost= xxx  //my vps ip address
SocketConnectPort= xxx  //my vps port //specified on stunnel
DataDictionary=FIX44.xml

================================================================================== Updated on 28/11/2014 ================================================== ================================更新于2014年11月28日

Taking suggestion from xpa1492, I put Borker's IP address and port number on SocketConnectHost and SocketConnectPort. 根据xpa1492的建议,我将Borker的IP地址和端口号放在SocketConnectHost和SocketConnectPort上。 Here is the log message I am getting from my QuickFix Client Application. 这是我从QuickFix客户端应用程序获取的日志消息。 It seems that initial connection is made but maybe logon request is not valid somehow. 似乎初始连接已经完成,但是登录请求可能无论如何都无效。

<event> connecting to xxx (ip address of broker); 
<event> connection succeeded; 
<event> session reset: ResetOnLogon; 
<event> session reset ResetSetNumFlag; 
<outgoing> 8=Fix4.4 ...... ; 
<event> initiated logon request; 
<incoming> 8=FIX4.4 .....; 
<event> received logout request; 
<outgoing> 8=FIX4.4 .....; 
<event> sending logout response;

Details of incoming message from brokers when they send logout request. 来自代理发送注销请求时传入消息的详细信息。

<incoming> 8=FIX4.4   9=63   35=5   34=1  49=FIXORDER   52=20141128-02:09:00.495   56=TargetCompID(from acceptor standing point of view=SenderID for me)   10=171

It is very common for FIX servers to drop connections when they don't like something about your first message (which is always the logon message). FIX服务器在他们不喜欢您的第一条消息(始终是登录消息)时放弃连接是很常见的。 Based on the error you are getting, this is exactly what is happening - you connect to the server, send the Logon message and then the server drops the connection. 根据您获得的错误,这正是发生的事情 - 您连接到服务器,发送登录消息,然后服务器断开连接。

The right way to solve the issue is to contact tech support on the other end and ask them why they are dropping the connection. 解决问题的正确方法是联系另一端的技术支持,并询问他们为何放弃连接。

If this is not feasible, you will need to experiment with what might be wrong. 如果这不可行,您需要尝试可能出错的地方。 In my experience, the problem is often a mismatch in the sequence numbers (tag 34). 根据我的经验,问题通常是序列号不匹配(标签34)。 Most servers would maintain the last sequence number you sent (say 1) and after a disconnect would expect you to send your Logon message with the next number (2 in this example). 大多数服务器将保留您发送的最后一个序列号(例如1),并且在断开连接后,您希望使用下一个号码(本例中为2)发送您的登录消息。 Try starting from 1 and incrementing the seq number between reconnects. 尝试从1开始并在重新连接之间递增seq编号。

Another possible issue is wrong CompIDs (Sender or Targer). 另一个可能的问题是错误的CompID(发件人或Targer)。

UPDATE (sTunnel and SSL certificate setup): 更新(sTunnel和SSL证书设置):

It is possible that the server drops the connection because you are not connecting over SSL... You stunnel.conf file needs to look like this: 服务器可能会因为您没有通过SSL连接而断开连接...您的stunnel.conf文件需要如下所示:

; Enable debug (7 is the most verbose output)
debug = 7
output = stunnel.log

[FIXORDER]
client = yes
accept = 127.0.0.1:[port number your client connects to]
connect = [fix server ip]:[fix server port]
cert =  xxx_cert.pem
key = xxx_key.pem

Note that accept can be 127.0.0.1 or the IP of your VPS server, but 127.0.0.1 is the preferred choice. 请注意, accept可以是127.0.0.1或您的VPS服务器的IP,但127.0.0.1是首选。 Your Fix client can then also just connect to 127.0.0.1 (where sTunnel listens). 您的Fix客户端也可以只连接到127.0.0.1(sTunnel侦听)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM