Jump to content
Sign in to follow this  
Guest DSN63

SIMCONNECT_EXCEPTION_TOO_MANY_REQUESTS

Recommended Posts

>After letting the>program run for a while I start to get the following>exception:>>SIMCONNECT_EXCEPTION_TOO_MANY_REQUESTS>Specifies that the maximum number of requests allowed has been>reached. The maximum is 1000.>>Is the 1000 maximum referring to a single object or total>requests for the SimConnect session?I think it is the maximum for one Data Definition. It sounds like you are Adding too many data items to one definition (using SimConnect_AddToDataDefinition. I doubt that there are as many as 1000 different items you can add in any case, so possibly you have a loop someplace which is adding them unintentionally?>I am using a unique request ID for each object creation>request and then another unique ID for each of the 2>SimConnect_RequestDataOnSimObject calls on each new object>after I receive the SIMCONNECT_RECV_ID_ASSIGNED_OBJECT_ID>message in my dispatch functionAre you perhaps repeating the AddToDataDefinition calls for each object, when you only need to create the data definition once and apply it to all objects?RegardsPete


Win10: 22H2 19045.2728
CPU: 9900KS at 5.5GHz
Memory: 32Gb at 3800 MHz.
GPU:  RTX 24Gb Titan
2 x 2160p projectors at 25Hz onto 200 FOV curved screen

Share this post


Link to post
Share on other sites
Guest DSN63

Pete,Thanks for your input.In my code, I am setting data definitions and subscribing to events only after receiving the SIMCONNECT_RECV_ID_OPEN message in the dispatch function.Let me use an example to explain my question:If I create n number of AI objects using SimConnect_AICreateEnrouteATCAircraft, I am assigning a unique requestID for each of the n calls to AICreateEnrouteATCAircraft. Then if I call SimConnect_RequestDataOnSimObject (to request lat and lon) for each of the objects created above, I am supplying yet another unique request ID for each of the n calls to SimConnect_RequestDataOnSimObject.Do I need to use a unique request ID for each object or each actual request?Thanks again for your assistance-David

Share this post


Link to post
Share on other sites

>If I create n number of AI objects using>SimConnect_AICreateEnrouteATCAircraft, I am assigning a unique>requestID for each of the n calls to>AICreateEnrouteATCAircraft. Then if I call>SimConnect_RequestDataOnSimObject (to request lat and lon) for>each of the objects created above, I am supplying yet another>unique request ID for each of the n calls to>SimConnect_RequestDataOnSimObject.As far as I am aware the request ID doesn't matter a lot, except that a subsequent request with the same ID supplants the previous one.In the details you have just described, is n approaching 1000?The only thing I know of which can give the "too many requests" error is having over 1000 data items added to the one data definition. There may be others, but I can't see where they could arise.RegardsPete


Win10: 22H2 19045.2728
CPU: 9900KS at 5.5GHz
Memory: 32Gb at 3800 MHz.
GPU:  RTX 24Gb Titan
2 x 2160p projectors at 25Hz onto 200 FOV curved screen

Share this post


Link to post
Share on other sites
Guest Torin

Shouldn't you be using a struct to get all the requests at once using one ID?

Share this post


Link to post
Share on other sites

>Shouldn't you be using a struct to get all the requests at>once using one ID? Structs relate to data for one object, not multiple objects (aircraft) which each need their own id. I don't know any way of asking for and receiving a whole array of structs with one set for each of many objects.Data in structs is identified to SimConnect by the AddToDataDefinition call. As I was saying, I think that there is a limit to how many data items you can add to one data definition -- i.e. one data id. Since the limit is, I believe, somewhere around 1000 items of data, the only likely way of hitting it is if there are additions being made in a loop -- for instance, repeatedly for each object. Obviously you only define the data definition once (the struct), no matter how many objects you then request data for.RegardsPete


Win10: 22H2 19045.2728
CPU: 9900KS at 5.5GHz
Memory: 32Gb at 3800 MHz.
GPU:  RTX 24Gb Titan
2 x 2160p projectors at 25Hz onto 200 FOV curved screen

Share this post


Link to post
Share on other sites

I think I get the picture. You're basically making a new request ID for each request you make of an aircraft. After 999 updates of the same aircraft, you're hitting that 1000 ID limit and Simconnect is kicking you out the door.What information are you gathering specifically? If its AI aircraft data for a TCAS or such system, there is a way of you to get the information with using only 1 ID and then parsing the IDs you receive in the ON_RECV_DATA_BY_OBJECT_TYPE message section. One of the bits of information is a DWORD called dwObjectID which is the ID of the object you are receiving.I store this information in a vector-type array (I'm using C# so its a Generic List object of a struct with my data). I have 2 structs, one for the data definition and one for the vector array list. The only difference is the second one has a uint variable that I later store the ObjectID in. When I get to the recv_data_by_object_type section of my code, I use a select statement looking for the AI AC data and if the ObjectID is other than 1, its talking about a simulator object. I then look through the array for a duplicate ID. If I find one, I delete that record and add a new one with the new information and the ID. If I don't find the ID in the array list, I add a new record at the end with the information.Hope this helps any.

Share this post


Link to post
Share on other sites
Guest ziporama

Simconnect is not designed to register one request per object - as you found out. It also makes SimConnect quite slow because it cannot batch the data to you and send it to you as one whole packet which is much more efficient communication wise. I would look into using the batch request functions viaSimConnect_RequestDataOnSimObjectTypewhich lets you use a single request ID, yet retrieve data for all AI aircraft in the radius you specify (max is 200 kilometers). You can retrieve all AI objects, or you can specify subtypes as well. The ID of the object the data applies to is returned in the dwObjectID of SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPEwhich is the same as SIMCONNECT_RECV_SIMOBJECT_DATASince you know the ID of the object that was created via one of the Create functions, you should be able to do what you need to do.Hope this helps,Etienne

Share this post


Link to post
Share on other sites

<<Simconnect is not designed to register one request per object >>Sure it is, that's what the period value on the RequestDataOnSimObject is for (PERIOD_SECOND, PERIOD_VISUAL_FRAME, PERIOD_SIM_FRAME, etc), you just can't have more than 1000 outstanding requests at one time (why Dave specifically chose 1000 as the limit, I have no idea :-> ).Tim

Share this post


Link to post
Share on other sites
Guest ziporama
<<Simconnect is not designed to register one request per object >>Sure it is, that's what the period value on the RequestDataOnSimObject is for (PERIOD_SECOND, PERIOD_VISUAL_FRAME, PERIOD_SIM_FRAME, etc), you just can't have more than 1000 outstanding requests at one time (why Dave specifically chose 1000 as the limit, I have no idea :-> ).Tim
Methinks we're saying the same thing :)Etienne

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...