Tagged ClientData always has -1 as DatumID

Version: SunRise 12.2, SDK 1.6.7

Frequency: Consistently

Severity: Blocker

Marketplace package name: N/A

Context: SimConnect SDK

Similar MSFS 2020 issue: Same issue also for MSFS 2020.

Bug description:

When I request ClientData with the SIMCONNECT_CLIENT_DATA_SET_FLAG_TAGGED flag, I receive SIMCONNECT_RECV_CLIENT_DATA messages with the correct flag set (SIMCONNECT_DATA_REQUEST_FLAG_TAGGED) and the correct message size, but all DatumID values in the data have value 0xFFFFFFFF. The actual fields themselves have the correct value. Note If I request with also the SIMCONNECT_CLIENT_DATA_REQUEST_FLAG_CHANGED flag specified, SimConnect correctly only sends the changed fields. It’s just that the DatumIDs, which would tell me which field was changed, is always 0xFFFFFFFF. (or -1)

Repro steps:

Extract the two client apps from the attached ZIP. They are in subdirectories “client-1” and “client-2”, using a shared header.

Sender:

lient-1>.\client-1.exe --delay=10 --tagged 5 10
[Client data area created and definition registered.]
[Waiting 10 second(s) before sending 5 updates.]
[Connected to 'SunRise' version 12.2 (build 282174.999) using SimConnect version 12.2 (build 0.0)]
[Sending client data block with count=1, diff=9, value=10 (tagged=true, size=24 bytes)...]
  0000: 01 00 00 00 01 00 00 00 02 00 00 00 09 00 00 00
  0010: 03 00 00 00 0A 00 00 00
[Sending client data block with count=2, diff=8, value=10 (tagged=true, size=24 bytes)...]
  0000: 01 00 00 00 02 00 00 00 02 00 00 00 08 00 00 00
  0010: 03 00 00 00 0A 00 00 00
[Sending client data block with count=3, diff=7, value=10 (tagged=true, size=24 bytes)...]
  0000: 01 00 00 00 03 00 00 00 02 00 00 00 07 00 00 00
  0010: 03 00 00 00 0A 00 00 00
[Sending client data block with count=4, diff=6, value=10 (tagged=true, size=24 bytes)...]
  0000: 01 00 00 00 04 00 00 00 02 00 00 00 06 00 00 00
  0010: 03 00 00 00 0A 00 00 00
[Sending client data block with count=5, diff=5, value=10 (tagged=true, size=24 bytes)...]
  0000: 01 00 00 00 05 00 00 00 02 00 00 00 05 00 00 00
  0010: 03 00 00 00 0A 00 00 00
[All updates sent.]
Sent: count=-1, diff=-1, value=-1
[Disconnecting from the simulator.]
[Closing event handle.]

Receiver:

client-2>.\client-2.exe --tagged
[Using TAGGED delivery.]
[Subscribed to 'DutchFlightSim.SandboxCounter' (flags=0x00000002). Waiting for messages...]
[Connected to 'SunRise' version 12.2 (build 282174.999) using SimConnect version 12.2 (build 0.0)]
CLIENT_DATA received:
  dwRequestID   = 1
  dwObjectID    = 0
  dwDefineID    = 1
  dwFlags       = 0x00000002
  dwentrynumber = 1
  dwoutof       = 1
  dwDefineCount = 3
  body (24 bytes):
  0000: FF FF FF FF 01 00 00 00 FF FF FF FF 09 00 00 00
  0010: FF FF FF FF 0A 00 00 00
CLIENT_DATA received:
  dwRequestID   = 1
  dwObjectID    = 0
  dwDefineID    = 1
  dwFlags       = 0x00000002
  dwentrynumber = 1
  dwoutof       = 1
  dwDefineCount = 3
  body (24 bytes):
  0000: FF FF FF FF 02 00 00 00 FF FF FF FF 08 00 00 00
  0010: FF FF FF FF 0A 00 00 00
CLIENT_DATA received:
  dwRequestID   = 1
  dwObjectID    = 0
  dwDefineID    = 1
  dwFlags       = 0x00000002
  dwentrynumber = 1
  dwoutof       = 1
  dwDefineCount = 3
  body (24 bytes):
  0000: FF FF FF FF 03 00 00 00 FF FF FF FF 07 00 00 00
  0010: FF FF FF FF 0A 00 00 00
CLIENT_DATA received:
  dwRequestID   = 1
  dwObjectID    = 0
  dwDefineID    = 1
  dwFlags       = 0x00000002
  dwentrynumber = 1
  dwoutof       = 1
  dwDefineCount = 3
  body (24 bytes):
  0000: FF FF FF FF 04 00 00 00 FF FF FF FF 06 00 00 00
  0010: FF FF FF FF 0A 00 00 00
CLIENT_DATA received:
  dwRequestID   = 1
  dwObjectID    = 0
  dwDefineID    = 1
  dwFlags       = 0x00000002
  dwentrynumber = 1
  dwoutof       = 1
  dwDefineCount = 3
  body (24 bytes):
  0000: FF FF FF FF 05 00 00 00 FF FF FF FF 05 00 00 00
  0010: FF FF FF FF 0A 00 00 00
CLIENT_DATA received:
  dwRequestID   = 1
  dwObjectID    = 0
  dwDefineID    = 1
  dwFlags       = 0x00000002
  dwentrynumber = 1
  dwoutof       = 1
  dwDefineCount = 3
  body (24 bytes):
  0000: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
  0010: FF FF FF FF FF FF FF FF
^C

Sending untagged (not specifying “--tagged” to client-1 will get the same result. Specifying “--on-change” to client-2 will show only the second and third fields are received, but with -1 as DatumID. Sending tagged while receiving untagged and vice versa all seems to do what is intended, except for the ids.

Attachments:

client-data.zip (11.6 KB)

Private attachments: N/A

Hello @BenkeiBuddy,

This does not appear to be a SimConnect bug.
The issue was that the receiver-side ClientData definition was registered without explicit DatumIDs.

In that case, SimConnect_AddToClientDataDefinition() uses its default DatumID value SIMCONNECT_UNUSED (0xFFFFFFFF), so tagged delivery returns 0xFFFFFFFF as the tag.

In client-2, register explicit DatumIDs in SimConnect_AddToClientDataDefinition() instead of relying on the default value.

For example, use DatumIDs 1, 2, and 3 for the three INT32 fields, then rerun the repro.
The tagged output should then return 1, 2, and 3 instead of 0xFFFFFFFF.

Let me know if after updating the code it’s now working as expected.

Regards,
Boris

Ok, I assumed the client-ids were driven by the creator, since it “owns” the contract by creating the ClientData record. Tested and indeed this works. My apologees.

So:

  • The tags for the sender are only relevant if you want to use those to send individual (tagged) fields
  • The tags for the receiver are what determines the tag values when requesting on-changed and tagged
  • Requesting tagged but not on-change sounds like it provides no additional value

DatumID values are therefore completely local.

You may want to add the scope on the sender side to the docs. It currently only talks about receiving.

FYI I will update my YouTube episode on ClientData. I have added an example in part-11 (11-8 - Selective PMDG ClientData in C++ that uses this to define just a few MCP fields from the PMDG SDK’s struct and request them tagged and on-change. Nice example, as you only get data when the selected fields change, and only the data of the changed field, even though the 737 sends the full struct.

Cheers,
Bert

FYI the new episode on YouTube is up and demoes 11-8.

Cheers,
Bert

1 Like

Hello @BenkeiBuddy

I will check with the developers and get back to you once I have a clear answer.
Then we will update the documentation accordingly.

Regards,
Bortis