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

Singleton SimConnect Client

Messages
32
Country
unitedstates
Is there a way to limit the number of copies of a given SimConnect client that can connect to FSX? That is, is there a way to say that if a client on the local FSX machine is already connected, a copy of it from the network can't, or vice versa? I'm not looking to restrict other clients, just mine. I do not want multiple copies of my client connecting.
 
Hi,

Suggestion : If all your clients are running on the same computer, maybe you can check the process name using Win32 API to identify a running client.
You can find a lot of sample code fro retrieve process name using google.

Hope this help.

K.
 
I'm already dong that with a mutex. I need to figure out whether two are connected from different computers.
 
In the SimConnect.xml file, there is:
Code:
<MaxClients>64</MaxClients>
Maybe if you set the value to 1, the second client connection will fail.

K.
 
I am not aware that SimConnect can tell what clients are attached. However I have not worked with it directly in some time. I seem to recall that FSUIPC would do that - it could check to see if clients were registered or not.
 
Singleton SimConnect Client (SOLUTION FOUND)

I found a solution while reading through the SimConnect APIs.

Using...

Code:
simConnect.MapClientDataNameToID("Blah", ClientArea.Blah);
simConnect.CreateClientData(ClientArea.Blah, 16, SIMCONNECT_CREATE_CLIENT_DATA_FLAG.DEFAULT);

to create a "dummy" client data area, which I never intend to use, will trigger an exception (ALREADY_CREATED) when another copy of the add-on tries to create it again. I can then act on it to disconnect or quit the client.
 
I found a solution while reading through the SimConnect APIs.

Using...

Code:
simConnect.MapClientDataNameToID("Blah", ClientArea.Blah);
simConnect.CreateClientData(ClientArea.Blah, 16, SIMCONNECT_CREATE_CLIENT_DATA_FLAG.DEFAULT);

to create a "dummy" client data area, which I never intend to use, will trigger an exception (ALREADY_CREATED) when another copy of the add-on tries to create it again. I can then act on it to disconnect or quit the client.

Great - glad you found a solution
 
Back
Top