ftpSendOpts (Function)

Top  Previous  Next

Architecture:

NX32 / NX32L

Device support:

All

Firmware version:

5.18 / 2.12.00


This function will send an OPTS (options) command to the FTP server.

This can be used configure the server behavior, to e.g. enable or disable UTF-8 support.

 

Note: this function may not be supported on some FTP servers.

Note: Some options may prevent further communication on the current session.

 

Input:

ID : INT

The ID returned from ftpConnect.

 

opts : STRING

The options to send to the server.

 

Returns: INT

0


- Success.

- 1


- Failed to send option, see ftpLastResponse.

- 2


- Invalid ID.

- 3


- Missing or invalid opts.

- 4


- Session is busy with another operation.

- 5


- FTP not open, use ftpOpen to open interface.

- 10


- Communication with server not possible

 

Declaration:

FUNCTION ftpSendOpts : INT;
VAR_INPUT
  ID   : INT;
  opts : STRING;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
PROGRAM example;
VAR
  open : BOOL;
  host : STRING := "ftp.domain.com";
  usr   : STRING := "ftpuser";
  pwd   : STRING := "user pwd";
 
  name : STRING := "$CF$86.txt"; // "phi".txt
  id   : INT;
  size : DINT;
END_VAR;
 
  gsmPower(power := ON);
  gprsOpen();
 
BEGIN
 open := (ftpOpen() = 0);
IF open THEN
    id := ftpConnect(host := host, username := usr, password := pwd);
    rc := ftpSendOpts(id := id, opts := "UTF8 ON");
   
    size := ftpFileSize(id := id, name := name);
    DebugFmt(message := "Size of " + name + " is \4", v4 := size);
    ftpDisconnect(id := id);
END_IF;
ftpClose();
END;
END_PROGRAM;