RequestSettings Timeout is ignored when calling FindServers

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

Moderator: uasdknet

Post Reply
mse
Jr. Member
Jr. Member
Posts: 2
Joined: 08 Nov 2023, 09:35

RequestSettings Timeout is ignored when calling FindServers

Post by mse »

Hello,

UnifiedAutomation.UaClient Version=3.2.1.0

When calling the method "Discovery.FindServers" I only pass the url, I expect by the default values of the "RequestSettings" that the method runs only after 30 seconds in timeout (RequestSettings.OperationTimeout) if the specified server is not available, but the execution is already interrupted / canceled after 13 seconds.

Is this a bug or am I possibly overlooking a parameter that is actually responsible for this?

Best regards

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

Re: RequestSettings Timeout is ignored when calling FindServers

Post by Support Team »

Hello,

RequestSettings.OperationTimeout specifies a client side timeout. I.e. if the server does not send a response, the client sdk will throw a TimeoutException. However the server can send a service fault before the OperationTimeout exceeds.

Do you catch a TimeoutException or another excetion type (e.g. a StatusException)?
Best regards
Unified Automation Support Team

mse
Jr. Member
Jr. Member
Posts: 2
Joined: 08 Nov 2023, 09:35

Re: RequestSettings Timeout is ignored when calling FindServers

Post by mse »

Hello and thanks for the answer,

it is my intention that if a server is not reachable an exception is thrown (no matter if TimeoutException or StatusException), but only after the default 30 seconds timeout.

In my example, we assume that a server is running locally which is currently offline (so the server is not able to answer anything), here is a code from my test

using UnifiedAutomation.UaClient;

using (Discovery disc = new Discovery())
{
RequestSettings newSettings = new RequestSettings();
newSettings.OperationTimeout = 60000;
disc.DefaultRequestSettings = newSettings;
try
{
disc.FindServers("opc.tcp://127.0.0.1:48020", null, null, newSettings);
}
catch (Exception ex)
{
System.Console.WriteLine(ex.Message);
}

}

My understanding of the OperationTimeout is that in my case an exception is thrown after 60 seconds of trying to "connect".

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

Re: RequestSettings Timeout is ignored when calling FindServers

Post by Support Team »

Hello,

exceptions are thrown as soon as possible.
If an error occurs before the OperationTimeout has exceeded, an exception is thrown. Otherwise a TimeoutException is thrown.
Best regards
Unified Automation Support Team

Post Reply