Sign in to follow this  
Guest rbumm

SimConnect server closes

Recommended Posts

Hi, From a standalone client application (EXE), hSimConnect = Simconnect_open(...) is used to open a connection to the SimConnect server and receiving a valid handle. SimConnect_Close(hSimConnect) will close this session. Is there a possibility to detect that the SimConnect Server itself is closing (i.e. FSX is about to shut down) or no longer available ? Can you subscribe to a system event that will give you this information ? The standalone application would have to try reconnecting to the FSX server unless FSX is again started and the server is again available ... Any ideas ? rudolf

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

>Is there a possibility to detect that the SimConnect Server>itself is closing (i.e. FSX is about to shut down) or no>longer available ? Can you subscribe to a system event that>will give you this information ? There doesn't appear to be anything we can use. From my DLL (FSUIPC4) which is of course also a SimConnect Client I do get a call to an exported routine called "DLLstop", after which I can tidy my own resources, but by the time this is called it is mostly too late to do anything with FS, even via SimConnect.I have put in a request for some early warning event to be provided which still leaves scope for calls back to SimConnect.Regards,Pete Dowson

Share this post


Link to post
Share on other sites

Yes, there is actually ... when you get SIMCONNECT_RECV_ID_QUIT in the DispatchProc (or the OnRecvQuit event in C#) you know that FSX was exited.

Share this post


Link to post
Share on other sites

I was going to say, my online flight tracker (shameless plug) uses that and pops up a little message. It's been about a week and a half since I looked at the code, since I'm building the web interface for it, so I couldn't remember if that was the case.

Share this post


Link to post
Share on other sites

Thanks gurious, this sounds as it is exactly what I am looking for ...regardsrudolf

Share this post


Link to post
Share on other sites

>Yes, there is actually ... when you get>SIMCONNECT_RECV_ID_QUIT in the DispatchProc (or the OnRecvQuit>event in C#) you know that FSX was exited.Ah ... I'd seen that and forgotten all about it! It's because it is one you don't need to subscribe to!Thanks ... that may just come in handy for something I've been wanting to try!RegardsPete

Share this post


Link to post
Share on other sites

>Thanks ... that may just come in handy for something I've been>wanting to try!Well, after trying it I remembered why I didn't consider the QUIT event in my earlier reply here. It doesn't work, at least for a DLL! Maybe it is only applicable to external programs and is effectively the same as the DLL having its exported DLLstop routine called -- which is too late for my needs.I'll let my request for a proper, early warning, notification stand. ;-)Regards,Pete

Share this post


Link to post
Share on other sites

Pete, the previously mentioned event works well for me in a standalone client application. In fact, it is included in all the samples of SimConnect, just did not really see it before. When the event is received, I close the SimConnect connection and set hSimConnect = NULL. After that, I check in a timer procedure with 10 Hz whether SimConnect can be opened again (i.e. FSX is restarted, and my client has to go to work). I found it also helpful to subscribe to the 6Hz Simconnect event and the SimStop/Start events for doing all my client work - this seems to prevent SimConnect to flood with messages when FSX becomes slow or is loading ...regardsrb

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this