3

I'm trying to find a good way to detect a loss of connection.

My adapter is implemented as a Fix::Application based on one of the examples. It uses a socket initiator to connect to the fix gateway.

When I unplug the internet it takes about 30 seconds for the Fix::Application's onLogout method to be fired. It seems like some underlying class would be aware that there is a problem with the socket much earlier. Is there a quick way took hook into this?

Georg Fritzsche
  • 97,545
  • 26
  • 194
  • 236
Fredrick
  • 1,210
  • 2
  • 15
  • 24

2 Answers2

5

The best way to solve this would probably be to decrease your Heartbeat Interval so you know sooner. I don't know of any messages that fire for a loss of TCP connection, but I don't think QuickFix is listening for OS events either. Although, it would likely flow through the fromAdmin event if there were such a message.

Did you post your question to the QuickFix DL?

PeteK
  • 106
  • 1
  • 5
3

It's possible that the fix engine you're using doesn't call back when TCP is disconnected, or it calls back on something other than onLogout. Since you're using fix, I would guess it forces a logout due to missed heartbeats.

Quick way would be to look into the code and check where socket close is being handled, and what path executes when this happens.

Marcin
  • 12,245
  • 9
  • 42
  • 49