I am using the trade client application on this link below to make connection between one of my VPS server and brokers server.
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. 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). 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.
Here is what I put on the "stunnel.conf" file:
[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:
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.
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
Here I am updating my error log from Stunnel log file after I set debug verbose high taking the suggestion from xapi1492.
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
Still having difficult to find answer, so I decided to provide my config file for QuickFix client application.
[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
Taking suggestion from xpa1492, I put Borker's IP address and port number on SocketConnectHost and SocketConnectPort. Here is the log message I am getting from my QuickFix Client Application. 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