简体   繁体   中英

Why is connection being reset during FIX logon?

I'm having an issue when testing my FIX client against my FIX server. My client logs look like this and you can see that the connection is being reset and I'm trying to determine why.

FIX client logs:

<event> Created session
<event> Connecting to 127.0.0.1 on port 5001
2/1/2023 2:50:32 PM inf: [FixClient] ToAdmin: FIX.4.4:CLIENT->SERVER [98, 2], [108, 30]
<event> Connection succeeded
<event> Session reset: ResetOnLogon
2/1/2023 2:50:32 PM inf: [FixClient] ToAdmin: FIX.4.4:CLIENT->SERVER [98, 0], [108, 30], [141, Y]
<event> Session reset: ResetSeqNumFlag
<outgoing> 8=FIX.4.49=7335=A34=149=CLIENT52=20230201-14:50:32.20356=SERVER98=0108=30141=Y10=177
<event> Initiated logon request
<event> Session FIX.4.4:CLIENT->SERVER disconnecting: System.Net.Sockets.SocketException (54): Connection reset by peer
   at QuickFix.SocketInitiatorThread.ReadSome(Byte[] buffer, Int32 timeoutMilliseconds)
   at QuickFix.SocketInitiatorThread.Read()
2/1/2023 2:50:32 PM inf: [FixClient] OnLogout: FIX.4.4:CLIENT->SERVER
<event> Session reset: ResetOnDisconnect

Client:

SessionID sessionId = new SessionID("FIX.4.4", "CLIENT", "SERVER");

var logon = new QuickFix.FIX44.Logon {
    EncryptMethod = new EncryptMethod(EncryptMethod.None),
    HeartBtInt = new HeartBtInt(30)
};

Session.SendToTarget(logon, sessionId);

client.cfg:

[DEFAULT]
ConnectionType=initiator
ReconnectInterval=30
FileStorePath=store
FileLogPath=log
StartTime=00:00:00
EndTime=00:00:00
UseDataDictionary=Y
DataDictionary=./FIX/spec/FIX44.xml
SocketConnectHost=127.0.0.1
SocketConnectPort=5001
LogoutTimeout=5
ResetOnLogon=Y
ResetOnLogout=Y
ResetOnDisconnect=Y

[SESSION]
# inherit ConnectionType, ReconnectInterval and SenderCompID from default
BeginString=FIX.4.4
SenderCompID=CLIENT
TargetCompID=SERVER
HeartBtInt=30

server.cfg:

[DEFAULT]
ConnectionType=acceptor
SocketAcceptPort=5001
StartTime=00:00:00
EndTime=00:00:00
FileLogPath=log
UseDataDictionary=Y
ResetOnLogon=Y
ResetOnLogout=Y
ResetOnDisconnect=Y

[SESSION]
BeginString=FIX.4.4
SenderCompID=CLIENT
TargetCompID=SERVER
FileStorePath=store
DataDictionary=./FIX/spec/FIX44.xml

It is the CompIDs.

Server and client should have swapped CompIDs. Server TargetCompID is Client SenderCompID and vice versa.

Related: What causes the "Disconnecting: Encountered END_OF_STREAM" session message in QuickFIX/J?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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