How to create file transfer between server and client

Questions regarding the use of the C++ SDK for Server or Client development or integration into customer products ...

Moderator: uasdkcpp

Post Reply
Kangskii
Full Member
Full Member
Posts: 9
Joined: 21 Sep 2016, 04:15

How to create file transfer between server and client

Post by Kangskii »

Dear Support Team,
Now, I want to develop a file transfer function between server and client, and my solution is add variable whose type is FileDirectoryType in address space(I develop the address space via hard code, not xml). File transfer will be realized by FileDirectoryType::MoveOrCopy. I am not sure this soulution is correct, so I need your advice. By the way, I didn't find the demo about FileDirectoryType , can you give me some samples about adding FileDirectoryType node in address space via hard code?
Thank you!

User avatar
Support Team
Hero Member
Hero Member
Posts: 3068
Joined: 18 Mar 2011, 15:09

Re: How to create file transfer between server and client

Post by Support Team »

Hello Kangskii,

you couldd implement a file transfer using that mechanism.
Note that the SDK provides the class for the FileDirectoryType but you still need to implement the functionality to Create, Delete, Mode and Copy Files and Directories.
This does not work out-of-the-box.

Code: Select all

    // Create an instance of FileDirectoryType
    UaString sName("MyFileDirectory");
    OpcUa::FileDirectoryType* pFileDirectory = new OpcUa::FileDirectoryType(
        UaNodeId(sName, getNameSpaceIndex()),
        sName,
        getNameSpaceIndex(),
        this);
    addNodeAndReference(OpcUaId_ObjectsFolder, pFileDirectory, OpcUaId_Organizes);

    // set the callback
    MyFileDirectoryTypeCallback* pCallback = new MyFileDirectoryTypeCallback();
    pFileDirectory->setCallback(pCallback);
You at least need to implement the FileDirectoryTypeCallback. We can not provide a sample code for that callback implementation.
Best regards
Unified Automation Support Team

Post Reply