Stunnel "Peer suddenly disconnected" error with QuickFix/n

auto9817 picture auto9817 · Nov 27, 2014 · Viewed 7.4k times · Source

Recently I started to use Stunnel program with QuickFix/n Engine to connect my VPS server and broker's server.

I am getting "Peer suddenly disconnected" error from Stunnel. I am very new to Stunnel and would like to know what are the possible problem for this "Peer suddenly disconnected" error. Below is the log message from log file of stunnel while I am running QuickFix application.

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)

Here is some code lines I wrote on stunnel.conf file to establish the connection between my VPS and Broker's server. I put my VPS IP address to "accept" and I put broker's IP address to "connect". As brokers gave me two different ports to connect, I wrote lines for two different connection.

[FIXPrice]
client = yes
accept = x.xxx.xxx.xxx:3001
connect = xxx.x.xx.xxx:9001


[FIXORDER]
client = yes
accept = x.xxx.xxx.xxx:3002
connect = xxx.x.xx.xxx:9002

After set up stunnel.conf file, I run the stunnel service. Then I started my Quick Fix application to establish connection. However my Quick Fix Application can not pass the log on stage and Stunnel keep getting "Peer suddenly disconnected" error repeatedly.

I am new to stunnel and I really would like to learn how to fix this problem. Any thought or tips will be really appreciated.

Thanks so much in advance.

Kind regards.

M.

Answer

user3079759 picture user3079759 · Jan 27, 2015

I encountered the same problem in Mac OS, but just solved it by adding the certificate to the keychain access, so that the browsers (Chrome and Safari) will acknowledge the certificate and the connection will establish.