dOPC Client Toolkit
Close
ua.client.TdOPCUAClient.ReadServerStatus

Reads the status of the UA server

function ReadServerStatus(ServerStatus: uaServerStatusDataType; Timeout: integer = 0): uaStatuscode;
__fastcall uaStatuscode ReadServerStatus(uaServerStatusDataType ServerStatus, int Timeout = 0);

If connected to the OPC UA server you can read with this method the server status. 

Below you will find an example that show you the handling. The method returns the server status which has the datatype uaServerStatusDataType.

program ReadStatus; {$APPTYPE CONSOLE} {$R *.res} uses sysutils, ua.client, ua.datatypes, ua.buildintypes; var OPCClient: TdOPCUaClient; ServerStatus: uaServerStatusDataType; begin OPCClient := TdOPCUaClient.Create(nil); ServerStatus := uaServerStatusDataType.Create; OPCClient.Url := 'opc.tcp://islgmbh3.intern.isl.org:53530/OPCUA/SimulationServer'; try OPCClient.Active := true; OPCClient.ReadServerStatus(ServerStatus); Writeln(ServerStatus.ToString); OPCClient.Active := false; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; ServerStatus.Free; OPCClient.Free; readln; end.
Kassl GmbH Copyright © 2024. All rights reserved.