• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Monitoring SimConnect and lost connections...

Messages
65
Country
us-massachusetts
Hi there, I have a pretty fundamental question about SimConnect that hopefully a lot of people could answer, I'd really appreciate help...

I'm writing a C++ .exe SimConnect client. On establishing a connection, among other things, it requests that certain variables be sent to me every frame. Of course, I want my program to establish a connection when it starts up, or if FSX is not running, to establish a connection when the Sim starts up. In addition, I've noticed that SimConnect sometimes, somehow, fails - that is, every once in a while I stop receiving messages while the sim is running, for no apparent reason (though it seems to happen during heavy weather/scenery loads or after switching the user aircraft many times). So if this happens, I'd like my program to reestablish a connection.

What I've done so far is to create a windows timer, which checks to see if my simconnect DispatchProcedure function has been called in the last ten seconds. If it hasn't been called, I attempt to close and reopen SimConnect. I quickly noticed that information was not sent while the sim is paused or in UI mode, and the client would needlessly disconnect and reconnect. Requesting a four-second timer from SimConnect solves this problem when the sim is paused, and sometimes when it's in UI. However, often when it is in UI mode, especially in the main FS UI at startup and while the "flight loading" progress bar is displayed, I don't seem to get the timer messages.

So my question is: is there a correct way to evaluate the status of the connection during all phases of FSX operation (running, paused, UI, Loading, etc.) and reconnect if necessary, as well as to insure that the client connects relatively quickly every time the simulator is started? I also tried checking the return value of SimConnect_CallDispatch() but it seems often to return OK when the sim is not even running?

I'd really appreciate any help, Thanks!

Farley
 
You need to subscribe to the events "SimStart" and "SimStop." On loading you begin in the stopped state, then after the user selects the aircraft and location you will get several start/stop events but end on "start." Likewise if the user later goes into the UI, or scenery needs to reload you will get a stop then start when it comes back.
 
Back
Top