Hello,
I'm using version 5.35.411.1 and trying to set a timeout value for BrowseServers. The problem is, the timeout is not occurring and the call to BrowseServers() continues to wait after my specified timeout.
I used the following code below to test it out and print out the time it takes for each operation, and if the operation threw an OPCException (timeout occurred):
EasyDAClient client = new EasyDAClient();
client.InstanceParameters.Timeouts.BrowseServers = 500;
client.InstanceParameters.Timeouts.ReadItem = 500;
Stopwatch timer = new Stopwatch();
//BrowseServers timeout test
ServerElementCollection serverList = new ServerElementCollection();
timer.Start();
try{
serverList = client.BrowseServers("");
}
catch (OpcException e)
{
Console.WriteLine("Error browsing servers: " + (e.InnerException != null ? e.InnerException.Message : e.Message));
}
timer.Stop();
Console.WriteLine("Time to browse servers: " + timer.Elapsed);
foreach (ServerElement server in serverList)
{
Console.WriteLine(server.ProgId);
}
//ReadItem timeout test
timer.Restart();
try
{
Console.WriteLine("Value: " + client.ReadItem("OPCLabs.KitServer.2", "Demo.Ramp"));
}
catch (OpcException e)
{
Console.WriteLine("Error reading tag: " + (e.InnerException != null ? e.InnerException.Message : e.Message));
}
timer.Stop();
Console.WriteLine("Time to read item: " + timer.Elapsed);
To make sure it was not a mistake on my part, I also set the timeout for ReadItem, but I DO get the timeout to occur there - so it seems like it is something with the BrowseServers timeout setting specifically that I am missing. Am I doing something incorrectly?
Any input would be greatly appreciated. Thanks!