views:

36

answers:

1

I work for a trading company where our users interact with the primary trading application via a Remote Desktop connection to a server that's physically located within the exchange's facilities.

A feature of our software is that it disconnects and pulls all quotes automatically if something goes wrong with the network and the RD session becomes disconnected.

Detecting this is accomplished by overriding the WndProc method of the application's main form, where the message parameter is checked for:

Msg == WM_WTSSESSION_CHANGE

and:

WParam.ToInt32() == WTR_REMOTE_DISCONNECT

This seems to work great in normal cases of the remote desktop becoming completely disconnected.

However, it sometimes happens that the users experience a short period of apparent disconnection, where the RD session becomes unresponsive (i.e., clicking doesn't do anything) but apparently the message described above is not received/processed. Within a few moments -- usually ~10 seconds -- the user sees the message "Reconnecting to remote desktop..." (or something like that) and suddenly the RD session starts responding again.

Since the whole idea of this pull-quotes-on-remote-desktop-disconnect feature is to prevent the scenario where, basically, our application is trading without the user being able to see what's happening, it's very desirable for us to be able to detect when the RD session is in what I'll describe as this "almost disconnected" state.

Anybody know how we could detect this?

+1  A: 

My only suggestion would be to constantly ping the exchange server, and if the ping latency gets too high, disconnect.

I don't think the exchange would appreciate this idea.

Gilbert Le Blanc