hi,
is there a example code that uses the findServersOnNetwork instead of the findservers? im not that experienced in this so if anybody could help me that would be great!
im using the example Client_cpp_sdk latest version available. im trying to get the endpoints of an Server that is registered at the OPC UA Foundation LDS-ME on a another host.
FindServerOnNetwork
Moderator: uasdkcpp
- Support Team
- Hero Member
- Posts: 3069
- Joined: 18 Mar 2011, 15:09
Re: FindServerOnNetwork
Hello samsa123,
here's a sample how to call findServersOnNetwork.
here's a sample how to call findServersOnNetwork.
Code: Select all
UaDiscovery discovery;
ServiceSettings serviceSettings;
UaString sDiscoveryUrl = "opc.tcp://localhost:4840";
SessionSecurityInfo sessionSecurityInfo;
OpcUa_UInt32 startingRecordId = 0;
UaDateTime lastCounterResetTime;
UaServerOnNetworks servers;
UaStatus status = discovery.findServersOnNetwork(
serviceSettings, // Use default settings
sDiscoveryUrl, // Discovery Server Url
sessionSecurityInfo, // Use general settings for client
startingRecordId, // 0 since we want to get all records
lastCounterResetTime,
servers);
if (status.isGood())
{
for (OpcUa_UInt32 i = 0; i < servers.length(); i++)
{
UaServerOnNetwork server(servers[i]);
printf("********************************************************\n");
printf("servers[%d].ServerName: %s\n", i, server.getServerName().toUtf8());
printf("servers[%d].DiscoveryUrl: %s\n", i, server.getDiscoveryUrl().toUtf8());
}
}
else
{
// Handle Error
}
Best regards
Unified Automation Support Team
Unified Automation Support Team
-
- Jr. Member
- Posts: 2
- Joined: 02 Nov 2017, 11:39
Re: FindServerOnNetwork
it works! i can now discover all the servers on the local network.
thanks for the quick reply.
thanks for the quick reply.