views:

500

answers:

2

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?

A: 

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
Yeah, QuickFIX doesn't handle all socket errors well (even when establishing a new connection).
John Zwinck
+1  A: 

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
This works, I tested it.
jilles de wit