dOPC Client Toolkit
Close
ua.filestream.TuaByteStringStream
ua_filestream_TuaByteStringStream

A stream class to read and write files to and from an OPC UA Server.

TuaByteStringStream = class(TBytesStream);
class TuaByteStringStream : public TBytesStream;

TuaByteStringStream is a TBytesStream class extended to read and write files to and from an OPC UA Server. 

In addition to the TBytesStream class, TuaByteStringStream has the LoadFromOPCServer and SaveToOPCServer methods.

program OPCFileStream; {$APPTYPE CONSOLE} {$R *.res} uses sysutils, ua.client, ua.filestream; var OPCClient: TdOPCUaClient; ByteStringStream : TuaByteStringStream; begin OPCClient := TdOPCUaClient.Create(nil); ByteStringStream := TuaByteStringStream.Create; OPCClient.Url := 'opc.tcp://opcuaserver.com:48010'; try OPCClient.Active := true; Writeln('connected.'); ByteStringStream.LoadFromOPCServer(OPCClient,'ns=2;s=Demo.Files.serverconfig.xml'); Writeln('File loaded from OPC server.'); ByteStringStream.SaveToFile('c:\\aa\serverconfig.xml'); Writeln('File saved on the locale computer.'); OPCClient.Active := false; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; Writeln('Press enter to exit'); OPCClient.Free; readln; end.
dOPC version 5.33. Copyright © 2025 by Kassl GmbH.