• 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.

Communication problem between external module and wasm

Hello the the Community! I just migrated from X-Plane to MSFS and lost all my previous experience on coding external modules.
The context is the following:
I develop an external module between some hardware which I use and FBW320 using SimConnect. Most of it works well and I am able to send text displays and to switch leds from my module to the aircraft.
Unfortunately, I also have to send H: events to the aircraft and we know that this is not possible directly.
I wrote a little WASM module to receive an order from my external module and then use the gauge interface to execute it towards the aircraft.
I see from the MSFS debug console that my wasm is correctly loaded, has not error code in the initialization sequence, but never receive any data from my external module.
Her are the way I define the shared client data in external module and wasm:
external module:
if (FAILED(SimConnect_MapClientDataNameToID(hSimConnect, "JPPbridge", 0)))
LOG <= "MapClientDataNameToID has failed";
LOG <= "AddToClientDataDefinition has failed";
if (FAILED(SimConnect_CreateClientData(hSimConnect, 0, 8, SIMCONNECT_CREATE_CLIENT_DATA_FLAG_READ_ONLY)))
LOG <= "CreateClientData has failed";
fprintf(stderr, "JPPBridge initialization");
if (FAILED(SimConnect_Open(&hSimConnect, "JPPbridge", (HWND)NULL, 0, 0, 0)))
fprintf(stderr, "Open failed");
if (FAILED(SimConnect_CallDispatch(hSimConnect, MyDispatchProc, NULL)))
fprintf(stderr, "CallDispatch failed");
if (FAILED(SimConnect_MapClientDataNameToID(hSimConnect, "JPPbridge", 0)))
fprintf(stderr, "MapClientDataNameToID failed");
fprintf(stderr, "AddToClientDataDefinition failed");
if (FAILED(SimConnect_CreateClientData(hSimConnect, 0, 8, SIMCONNECT_CREATE_CLIENT_DATA_FLAG_READ_ONLY)))
fprintf(stderr, "CreateClientData has failed");
if (FAILED(SimConnect_RequestClientData(hSimConnect, 0, iReqID, 0, SIMCONNECT_CLIENT_DATA_PERIOD_ON_SET,
fprintf(stderr, "RequestClientData failed");

Finaly, the external module sent data like this:

if (FAILED(SimConnect_SetClientData(hSimConnect, 0, 0, 0, 0, 8, &BridgeContainer.m_data)))
LOG <= (string)"SetClientData failed for event " + to_string(id);

And the WasM receives it with a dispatch proc:
void CALLBACK MyDispatchProc(SIMCONNECT_RECV* pData, DWORD cbData, void* pContext)
//if (recv_data->dwRequestID == iReqID)
SBridge* cmd = (SBridge*)&recv_data->dwData;
execute_calculator_code(SEVENT[cmd->m_evt].m_name, nullptr, &cmd->m_val, nullptr);
fprintf(stderr, "execute event call %s with value %i", SEVENT[cmd->m_evt].m_name, cmd->m_val);

I sincerely hope that somebody with MSFS experience will be ablle to assist me and make me exit from my stucked situation. Thanks in advance.
I see two calls to CreateClientData... only the "owner" of the client data should be doing that. There should be only a single call to create the client data area.
Yes, this is what I did initially but as it was not working I followed the model which I cloned to build my own code and he was saying that each client must have a clientdata created. What you say seems more reasonable to me.
HBillet who wrote a nice explanation which I used said it was mandatory to have both. I think his implemenrtion worked because the second with same name was simply ignored.
Anyway, this is not the cause of my problem because it does not work with one single clientdata creation
External module... is it an executable or a DLL?

Also, you're defining your client data area as read-only... which means only the creator (owner) of the client data area can change it's content.
Last edited:
My problem is now solved.
Originally, I had a simple bug in my own code in a part not shown above.
The consequence was that communication was not even started.
I thought it was due to the fact I was using client data creation only on one side and I followed the wrong advice found on web to create on both side.
This of course did not somve the problem.
I then realized my own bug and fixed it.
But I was still with 2 client data creation.
When coming bacj to corret creation (only sender side ccreation), it worked.
Now I have some details to tune in the use of execute_calculator_command but I am progressing a lot.
Thanks a lot to WarpD who made me realize what the situation was.
You may want to download and read the SimConnect topic in this:-

Although I wrote it with P3D in mind, the section on SimConnect also applies to MSFS WASM. There is an entire topic devoted to SimConnect Client Events complete with code snipppets and the full source code.