ANSI C SDK Max Array Length

Questions regarding the use of the ANSI C SDK for Server or Client development or integration into customer products ...

Moderator: uasdkc

Post Reply
loum
Jr. Member
Jr. Member
Posts: 3
Joined: 07 Aug 2013, 18:54

ANSI C SDK Max Array Length

Post by loum »

For the ANSI C SDK, how should I change the default max array length in a custom provider?
I see the default is set in UaProvider_Server_InitServerCapabilities() to 65536.
What are the impacts of this change? e.g. Do I need to modify other stack callbacks?

In your experience how large of an array can the stack support?

Thanks

User avatar
Support Team
Hero Member
Hero Member
Posts: 3072
Joined: 18 Mar 2011, 15:09

Re: ANSI C SDK Max Array Length

Post by Support Team »

hi loum,

the function UaProvider_Server_InitServerCapabilities from the server provider fills the information into the UA variables defined by the OPC Foundation. This variables are only information for the client and have no influence on the SDK side.

However, this function uses the define OPCUA_ENCODER_MAXARRAYLENGTH which is defined by the UaStack in src/uastack/core/opcua_config.h
This defines the encoder/decoder limits of the UaStack.

In theory you can increase this to UINT32_MAX, but then you will hit other limits first.
The whole message must not exceed OPCUA_ENCODER_MAXMESSAGELENGTH (default=16777216), also OPCUA_SERIALIZER_MAXALLOC (default=16777216) must not be exceeded because this limit is used when allocating the array memory.

We have customers that have increased this MAXARRAYLENGTH to 10^5 without problems. I don't see a technical problem with 10^6 either, but we have not tested this.

regards.
Unified Automation Support Team

Post Reply