Re: [Quickfix-developers] Socket Monitoring/Verification
Brought to you by:
orenmnero
|
From: Dave L. <dav...@ma...> - 2007-03-25 12:46:51
|
> I am working on a QuickFIX App that connects to a counterparty
> where the connection is not very reliable. Checking the logs, I see on
> average half a dozen to ten re-logins each market day. I want to be a
> lot more proactive about tracking the status of the connection, and if
> possible, when it is time to send out an application message, check to
> see that the connection is good before even attempting to send it. I've
> put a try {} around my sendToTarget calls and attempted to catch
> exceptions related to the socket, but none get thrown. Even when I
> am testing and deliberately break the network connection, I still get
> no exception thrown.
>
No there won't be, the messages are persisted and will ultimately be resent
when the connection is reestablished.
> Does anyone have a decent rundown on what facilities are there in
> QuickFIX to monitor the status of the socket at a low level? Are there
> any flags or fields on the Session that I can check? Should I force a
> Test message before attempting to send Orders, etc.? I don't want to
> hack QuickFIX itself if I can avoid it.
>
The onLogout() in your interface will be called whenever there is a logout
or disconnection, so you could also use this to handle unexpected
disconnects.
You could check the session to see if it is logged on before you send the
message, perhaps something like:
FIX::Session* pSession = FIX::Session::lookupSession( sessionID );
if( pSession ) {
if( pSession->isLoggedOn() ) {
FIX::Session::sendToTarget( message, sessionID );
}
}
Cheers,
Dave
|