OPC Studio User's Guide and Reference
UAFileHandle Class
Members 



OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA.FileTransfer Namespace : UAFileHandle Class
An OPC UA file handle (encapsulates access request to the OPC UA file).
Syntax
'Declaration
 
<ComVisibleAttribute(False)>
<CLSCompliantAttribute(True)>
Public Class UAFileHandle 
   Inherits OpcLabs.BaseLib.Internal.ActionDefinedDisposable
   Implements System.IDisposable 
'Usage
 
Dim instance As UAFileHandle
[ComVisible(false)]
[CLSCompliant(true)]
public class UAFileHandle : OpcLabs.BaseLib.Internal.ActionDefinedDisposable, System.IDisposable  
[ComVisible(false)]
[CLSCompliant(true)]
public ref class UAFileHandle : public OpcLabs.BaseLib.Internal.ActionDefinedDisposable, System.IDisposable  
Remarks

The OPC UA file handle object implements System.IDisposable, and your code therefore must call System.IDisposable.Dispose when the OPC UA file handle is no longer needed. The OPC UA file handle, until disposed of, causes the client to keep a session open on the server.

This object is returned from the CreateFile and OpenFile methods. It is subsequently used to access the file in methods like ReadFile, WriteFile or IEasyUAFileTransfer.SetFilePosition. You eventually need to close the OPC UA file with this file handle, using the CloseFile method. Even after you close the OPC UA file, you still need to call System.IDisposable.Dispose.

Recommendation: Whenever possible, do not use this class directly, and use a higher-level abstraction instead. You can create System.IO.Stream objects for accessing the file data by using methods like OpcLabs.EasyOpc.UA.IO.Extensions.IEasyUAFileTransferExtension2.OpenOrCreateStream, or obtain them through a file provider (using IEasyUAFileTransferExtension.GetFileProvider2 or IEasyUAFileTransferExtension.GetWritableFileProvider).

The OPC UA file handle is "A handle for the file used in other method calls indicating not the file (this is done by the Object of the Method call) but the access request and thus the position in the file. The fileHandle is generated by the server and is unique for the Session. Clients cannot transfer the fileHandle to another Session but need to get a new fileHandle by calling the Open Method."

See OPC UA File Transfer Concepts for basic information about what is OPC UA File Transfer and how it works.

Inheritance Hierarchy

System.Object
      OpcLabs.EasyOpc.UA.FileTransfer.UAFileHandle

Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also

Reference

UAFileHandle Members
OpcLabs.EasyOpc.UA.FileTransfer Namespace
CloseFile Method
CreateFile Method
GetFilePosition Method
OpenFile Method
ReadFile Method
SetFilePosition Method
WriteFile Method
CreateAndOpenFile Method
CreateOrOpenFile Method
OpcLabs.EasyOpc.UA.FileTransfer.IEasyUAFileTransferExtension.OpenFile(OpcLabs.EasyOpc.UA.FileTransfer.IEasyUAFileTransfer,OpcLabs.EasyOpc.UA.UAEndpointDescriptor,OpcLabs.EasyOpc.UA.UANodeDescriptor,System.String,OpcLabs.EasyOpc.UA.FileTransfer.UAOpenFileModes)