Verifying FTPClient()
options
Use the following guidelines to help verify FTPClient()
has been configured correctly. The following image shows the instruction parameter entry dialog.
-
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 yourFTPClient()
instruction. This could occur if using theNumRecsStream
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) -
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) -
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) -
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) -
If using a directory for the
RemoteFileName
, ensure that the folder has already been created on the server. -
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) -
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) -
NumRecsStream
,IntervalStream
, andUnitsStream
are optional parameters that are only used if you are streaming data from a data table. -
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 setIntervalStream
to 0. -
If you are FTPing data from a table based on a time interval, the
NumRecsStream
parameter now becomes aTimeIntoInterval
parameter and must be filled in. In this case, aNumRecsStream
parameter of 0 with anIntervalStream
value of 60 with aUnitsStream
value of Min indicates the FTP instruction will execute 0 minutes into a 60-minute interval. -
FileOption
lets you select the format of the FTP file output on the server. The options include:Binary
,ASCII
,XML
, andJSON
.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
) -
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
)