Verifying FTPClient() options

Use the following guidelines to help verify FTPClient() has been configured correctly. The following image shows the instruction parameter entry dialog.

  1. Ensure that you are using the syntax FTPStatus=FTPClient() in order to see status codes in your Public table. FTPClient() returns the following status codes: -1 if successful, 0 if the connection fails, or -2 if execution did not occur when the instruction was called. Receiving an error of -2 likely means that your data table does not have enough records to execute, based on the requirements of your FTPClient() instruction. This could occur if using the NumRecsStream parameter for streaming data and the number of specified records has not been reached yet. If you are receiving the failure message of 0, see Comms watch (sniff) FTP communications and Analyzing FTP sniff-file error messages .

    See the highlighted portion of the following code snippet.

    FTPStatus=FTPClient ("IPAddress","User","Password","USR:Filename","Path/Filename",2)

  2. Verify the IPaddress (or server address) is correct. If your server is using implicit encryption (FTPS), you may have to specify the port number by adding :990 to the end of your server address. Otherwise, the data logger may attempt to do the communications over port 21 instead.

    See the highlighted portion of the following code snippet.

    FTPStatus=FTPClient ("IPAddress","User","Password","USR:Filename","Path/Filename",2)

  3. Verify your username and password are correct.

    See the highlighted portion of the following code snippet.

    FTPStatus=FTPClient ("IPAddress","User","Password","USR:Filename","Path/Filename",2)

  4. Verify your LocalFileName or table name is enclosed in quotes, unless it is a variable.

    See the highlighted portion of the following code snippet.

    FTPStatus=FTPClient ("IPAddress","User","Password","USR:Filename","Path/Filename",2)

  5. If using a directory for the RemoteFileName, ensure that the folder has already been created on the server.

  6. Enclose the contents of the RemoteFileName in quotes, unless you are using a variable.

    See the highlighted portion of the following code snippet.

    FTPStatus=FTPClient ("IPAddress","User","Password","USR:Filename","Path/Filename",2)

  7. Check the CRBasic Help to ensure that your PutGetOption matches the protocol and FTP function you want to perform. On the CR1000X/CR6, options 0-9 are for FTP, options 10-19 are for FTPS, and options 20-28 are for SFTP.

    See the highlighted portion of the following code snippet.

    FTPStatus=FTPClient ("IPAddress","User","Password","USR:Filename","Path/Filename",2)

  8. NumRecsStream, IntervalStream, and UnitsStream are optional parameters that are only used if you are streaming data from a data table.

  9. If you are FTPing data from a table based on the number of unsent records in that table, ensure that you have specified the number of records in NumRecsStream and also set IntervalStream to 0.

  10. If you are FTPing data from a table based on a time interval, the NumRecsStream parameter now becomes a TimeIntoInterval parameter and must be filled in. In this case, a NumRecsStream parameter of 0 with an IntervalStream value of 60 with a UnitsStream value of Min indicates the FTP instruction will execute 0 minutes into a 60-minute interval.

  11. FileOption lets you select the format of the FTP file output on the server. The options include: Binary, ASCII, XML, and JSON.

    NOTE:

    Option 8 (TOA5, Header, TimeStamp, Record#) is the standard output format for .dat files that LoggerNet creates.

    See the highlighted portion of the following code snippet.

    FTPStatus=FTPClient ("IPAddress","User","Password","USR:Filename","Path/Filename",2,0,60,Min,8,8000)

  12. The TimeOut parameter is in units of 0.01 seconds. The default is 7500 (75 seconds) does not need to be added to your instruction. Increasing it to greater than 7500 may help where latency or other network and server factors require the data logger to wait longer than normal for responses.

    FTPStatus=FTPClient ("IPAddress","User","Password","USR:Filename","Path/Filename",2,0,60,Min,8,8000)