dOPC Client Toolkit

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://'; 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 © 2023. All rights reserved.