Applies To:
  • CitectSCADA 5.xx, 5.50, 5.50 Service Pack A, 5.50 Service Pack B, 5.50 Service Pack C, 6.00

Summary:
I’d like to send a file to IDC during runtime. How can I do it? 

Solution:
It is possible to send a file to an IDC during runtime, by using FTP cicode functions. These functions are FTPOpen, FTPFileCopy and FTPClose. FTPOpen is a cicode function used to establish an FTP connection with an FTP server. Once a connection is established, FTPFileCopy can be used to copy a file from the FTP server to a remote path located in IDC. Please note that an accurate file path is very important when using the FTPFileCopy function. Once the transfer is successful, the FTP connection must be closed by using FTPClose. It is important to close the FTP connection to avoid a resource leak that may degrade the performance of CitectSCADA.

The following code shows how the above functions can be used to transfer a file to an IDC. A file called filetobetransfered.dat located in the Citect server Run directory is going to be transferred. The file will be copied to c:\Citect\data folder located on the IDC.

FUNCTION FileTrans()

    INT iFTPHdl;

    iFTPHdl = FtpOpen(“”,””,””); // This will establish a connection to citect FTP server

    // This will transfer a filetobetransfered.dat located in Citect server Run directory TO Citect – data folder located in IDC computer.

    FtpFileCopy(iFTPHdl,”filetobetransfered.dat”,”\Citect\data\filetobetransfered.dat”);

    FtpClose(iFTPHdl); //Close FTP connection

END


The above FTP functions are available to download files from FTP server. If you want to upload files from CitectSCADA to FTP server please refer to Q3911.

 

Keywords:
FTP, IDC  

Attachments