Skip to main content
Version: 4.2.5

FTP Server Object

Sends and retrieves files from an FTP server. Use the FTP Control to copy files between a local client and any FTP server.

note

File transfers use all available bandwidth to minimize the time it takes to transfer a file or buffer.

note

The default transfer type of this object depends on which version of iCore Integration Suite is installed. For more information, see FTP Server Object::Type.

note

The implementation of this object assumes that the remote FTP server uses the same default transfer type. Setting the Type property of this object to the default transfer type prior to the first file transfer in a session will not have any effect, since the implementation assumes that the server will use the default transfer type anyway.

If the FTP server does not use ASCII as default transfer type and the first file transfer should be in ASCII, send a TYPE command (use FTP Server Object::SendCommand) to set transfer type to ASCII. Example: ftpServerObject.SendCommand (CommandText: 'TYPE A', Return value: sReturnValue).

If the FTP server does not use Image as default transfer type and the first file transfer should be in Image, send a TYPE command (use FTP Server Object::SendCommand) to set transfer type to Image. Example: ftpServerObject.SendCommand (CommandText: 'TYPE I', Return value: sReturnValue).

Sections

Init, Main, Procedures, OnExit, and Structure.

note

The object is declared in the Declare section.

Properties

NameDescription
AllocateRequiredIndicates whether space must be allocated on a server as part of the Store method.
BufferSizeSpecifies the size (in bytes) of data buffer used in data transfer.
ConcurrentConnectionsSpecifies the number of concurrent connections to the server opened for receiving files. Applicable only when using FTPType transfer type.
DirectoryWorking directory on the server.
IncomingSpeedLimitThe maximum number of bytes per second that may be received. A value of 0 (zero) means unlimited.
LocalDataPortRestricts the local data port to a value or range compatible with your firewall.
LocalAddressAddress of the local host in dot notation.
LocalPortPort number that the socket is bound to.
OutgoingSpeedLimitThe maximum number of bytes per second that may be sent. Value of 0 (zero) means unlimited.
PassiveIndicates how the data connection is to be formed.
ProxyTypeThe type of proxy server used for this connection.
ProxyHostSpecifies the name or address of the proxy server that requests are to be routed through.
ProxyPortSpecifies the port used by proxy server that requests are to be routed through.
ProxyUsernameUsername to be sent on all requests through a proxy server that requires authentication.
ProxyPasswordPassword to be sent on all requests through a proxy server that requires authentication.
RemoteAddressReturns the address of the remote host in dot notation (i.e. nnn.nnn.nnn.nnn) when the State property is FTPState_Connected.
RemotePortReturns the port number of the remote host when the State property is FTPState_Connected.
StateStatus of the FTP connection.
StoreTypeType of store that will be performed when the Store method is called.
SystemType of operating system used by the server.
TimeoutTimeout in milliseconds.
TransferModeTransfer mode to be used for subsequent file transfers.
TypeData type to be used for subsequent file transfers.
UseFEATCommandSpecifies whether to send FEAT command to the server.
UseIPv6Specifies whether IPv6 should be used.
UseMLSDSpecifies whether to use MLSD command for directory listing.
VirtualHostNameName of the host to send using the HOST command.
ObjectIsEmptyReturns 1 if object is not created.
LastReturnCodeReturns last known return code from object.
note

Properties ObjectIsEmpty and LastReturnCode are common methods. For more information see Common properties and methods.

Methods

NameDescription
LoginLogin to FTP server.
LogoutLogout from FTP server.
SendCommandSends a command to the server.
StartTraceToFileStarts tracing to file.
StartTraceToSimpleStringListStarts tracing to a simple string list.
StopTraceStops tracing to file or simple string list.
StatusSends the STAT command to the server.
ListFetches a file directory listing.
NameListFetches a file directory listing with names only.
ChangeDirectoryUpSets the working directory to the parent directory.
DeleteFileDeletes a file on the server.
RenameFileRenames a file on the server.
MakeDirectoryCreates a directory on the server.
RemoveDirectoryDeletes a directory on the server.
MGetRetrieves (gets) multiple files.
MPutStores (puts) multiple files.
StoreStores (puts) a file.
RetrieveRetrieves (gets) a file.
CreateObjectCreates a new instance of the object.
FreeObjectReleases the instance of the object.
note

Methods CreateObject and FreeObject are common methods. For more information see Common properties and methods.

Properties


AllocateRequired

Indicates whether space must be allocated on a server as part of the Store method.

Type: ParamTypeBool
Default: False_Value
Read: get__AllocateRequired
Write: put__AllocateRequired

See Also

FTP Server Object::Store


BufferSize

Specifies the size (in bytes) of data buffer used in data transfer.

Type: Integer
Default: 262144
Read: get_BufferSize
Write: put_BufferSize


ConcurrentConnections

Specifies the number of concurrent connections to the server opened for receiving files. Applicable only when using FTPType transfer type.

Type: Integer
Default: -
Read: get_ConcurrentConnections
Write: put_ConcurrentConnections


Directory

Working directory on the server.

Type: String
Default: ''
Read: get_Directory
Write: put_Directory

See Also

FTP Server Object::ChangeDirectoryUp


IncomingSpeedLimit

The maximum number of bytes per second that may be received. A value of 0 (zero) means unlimited.

Type: Integer
Default: -
Read: get_IncomingSpeedLimit
Write: put_IncomingSpeedLimit


LocalDataPort

Restricts the local data port to a value or range compatible with your firewall.

Type: String
Default: 0
Read: get_LocalDataPort
Write: put_LocalDataPort

Remarks

The default value, "0", indicates that any port may be used. When set to a single value, such as "20", only that port will be used. When set to a range of values, such as "1024:1028", successive ports in this range will be tried until one can be opened. Use this property if for some reason the client machine is limited in the ports that can be used to make data connections. This is often the case in intranet environments where clients are restricted or firewalled for security purposes. When using this property it is recommended to specify a range of ports, if at all possible. The reason is that many FTP servers do not allow connections to a port unless a period of time has elapsed since the last connection to this port.

See Also

FTP Server Object::LocalPort


LocalAddress

Address of the local host in dot notation.

Type: String
Default: ''
Read: get_LocalAddress
Write: -

Remarks

When the State property is FTPState\_Connected, LocalAddress returns the address of the local host in dot notation (for example, nnn.nnn.nnn.nnn). When not connected, it returns an empty string.

See Also

FTP Server Object::LocalPort
FTP Server Object::State
FTP Server Object::RemotePort


LocalPort

Port number that the socket is bound to.

Type: Integer Default: -
Read: get_LocalPort
Write: -

Remarks

When the State property is FTPState\_Connected, LocalPort returns the port number that the socket is bound to. When not connected, it returns 0.

See Also

FTP ServerObject::LocalDataPort FTP Server Object::LocalAddress FTP Server Object::RemotePort


OutgoingSpeedLimit

The maximum number of bytes per second that may be sent. Value of 0 (zero) means unlimited.

Type: Integer
Default: 0 (unlimited) Read: get_OutgoingSpeedLimit
Write: put_OutgoingSpeedLimit


Passive

Indicates how the data connection is to be formed.

Type: ParamTypeBool
Default: True_Value
Read: get_Passive
Write: put_Passive


ProxyType

The type of proxy server used for this connection.

Type: FTPProxyType
Default: FTPProxy_None
Read: get_ProxyType
Write: put_ProxyType

See Also

FTPProxyType
FTP Server Object::ProxyHost
FTP Server Object::ProxyPort
FTP Server Object::ProxyUsername
FTP Server Object::ProxyPassword


ProxyHost

Specifies the name or address of the proxy server that requests are to be routed through.

Type: String
Default: ''
Read: get_ProxyHost
Write: put_ProxyHost

See Also

FTPProxyType
FTP Server Object::ProxyType
FTP Server Object::ProxyPort
FTP Server Object::ProxyUsername
FTP Server Object::ProxyPassword


ProxyPort

Specifies the port used by proxy server that requests are to be routed through.

Type: Integer
Default: -
Read: get_ProxyPort
Write: put_ProxyPort


ProxyUsername

Username to be sent on all requests through a proxy server that requires authentication.

Type: String
Default: ''
Read: get_ProxyUsername
Write: put_ProxyUsername

See Also

FTPProxyType
FTP Server Object::ProxyType
FTP Server Object::Host
FTP Server Object::ProxyPort
FTP Server Object::ProxyPassword


ProxyPassword

Password to be sent on all requests through a proxy server that requires authentication.

Type: String
Default: ''
Read: get_ProxyPassword
Write: put_ProxyPassword

See Also

FTPProxyType
FTP Server Object::ProxyType
FTP Server Object::Host
FTP Server Object::ProxyPort
FTP Server Object::ProxyUsername


RemoteAddress

Returns the address of the remote host in dot notation (i.e. nnn.nnn.nnn.nnn) when the State property is FTPState_Connected.

Type: String
Default: ''
Read: get_RemoteAddress
Write: -

See Also

FTP Server Object::LocalAddress


RemotePort

Returns the port number of the remote host when the State property is FTPState_Connected.

Type: String
Default: ''
Read: get_RemotePort
Write: -

See Also

FTP Server Object::LocalPort


State

Status of the FTP connection.

Type: FTPStateType
Default: -
Read: get_State
Write: -


StoreType

Type of store that will be performed when the Store method is called.

Type: FTPStoreType
Default: -
Read: get_StoreType
Write: put_StoreType

See Also

FTP Server Object::Store


System

Type of operating system used by the server.

Type: String
Default: -
Read: get_System
Write: -


Timeout

Timeout in milliseconds for a command.

Type: Integer
Default: 30000
Read: get_Timeout
Write: put_Timeout


TransferMode

Transfer mode to be used for subsequent file transfers. Available transfer modes are:

  • FTPTransferType_Stream
  • FTPTransferType_Block
  • FTPTransferType_Compressed

For detailed descriptions, see FTPTransferModeType.

Type: FTPTransferModeType
Default: FTPTransferType_Stream
Read: get_TransferMode
Write: put_TransferMode

warning

Only supports transfer mode: stream (default). Setting any other value will result in a runtime error.

See Also

FTPTransferModeType
FTP Server Object::Store
FTP Server Object::Retrieve
FTP Server Object::MPut
FTP Server Object::MGet


Type

Data type to be used for subsequent file transfers. Available types are:

  • FTPType_Ascii
  • FTPType_Image
  • FTPType_Ebcdic
  • FTPType_Zip

For detailed descriptions, see FTPType.

Type: FTPType
Default:
FTPType_Ascii (for iCIS versions earlier than 3.30.5)
FTPType_Image (for iCIS version 3.30.5 and later)
Read: get_Type
Write: put_Type

warning

Only supports types: ASCII and Image. Setting any other value will result in a runtime error.

See Also

FTPType
FTP Server Object::Store
FTP Server Object::Retrieve
FTP Server Object::MPut
FTP Server Object::MGet


UseFEATCommand

Specifies whether to send FEAT command to the server.

Type: ParamTypeBool
Default: True_Value
Read: get_UseFEATCommand
Write: put_UseFEATCommand

Remarks

The FEAT command is used by the FTP client to determine what extended features the FTP server supports.


UseIPv6

Specifies whether IPv6 should be used.

Type: ParamTypeBool
Default: False_Value
Read: get_UseIPv6
Write: put_UseIPv6


UseMLSD

Specifies whether to use MLSD command for directory listing.

Type: ParamTypeBool
Default: False_Value
Read: get_UseMLSD
Write: put_UseMLSD


VirtualHostName

Name of the host to send using the HOST command.

Type: String
Default: -
Read: get_VirtualHostName
Write: put_VirtualHostName

Remarks

The value of this property specifies the name of the host that the FTP client needs to get to when connecting to a server that supports multiple virtual host names. The property should be set before the call to the Login method.


Methods


Login

Login to FTP server.

Parameters

ServerNameType: String
Description: Specifies the name or IP address of the server.
UsernameType: String
Default: ''
Description: Specifies a user name for an account on the server.
PasswordType: String
Default: ''
Description: Specifies the account password associated with User.
RemotePortType: Integer
Default: 21
Description: Specifies the remote port to connect to.
AccountType: String
Default: ''
Description: Specifies an account on the server.

See Also

FTP Server Object::Logout
FTP Server Object::State


Logout

Logout from FTP server.

Parameters

-

See Also

FTP Server Object::Login


SendCommand

Sends a command to the server.

Parameters

CommandTextType: String
Description: The command text.
Return valueType: String
Description: The response from the server.

StartTraceToFile

Starts tracing to file.

Parameters

FilenameType: ParamTypeFilepath
Description: File path for trace file.

Remarks

Starts trace of FTP communication. You can trace to either a Simple String List Object or to a file on disk. It is not possible to trace to both a file and a string list at the same time. If StartTraceToFile is called followed by a StartTraceToSimpleStringList, the trace to file will end.

note

To make the trace file more suitable for presentation, use the custom Node Type FTP trace. For more information, see FTP TraceFormat.

See Also

FTP Server Object::StartTraceToSimpleStringList
FTP Server Object::StopTrace


StartTraceToSimpleStringList

Starts tracing to a simple string list.

Parameters

TraceSendType: ParamTypeBool
Default: False_Value
Description: A True_Value value indicates that sent data is to be traced.
TraceReceiveType: ParamTypeBool
Default: True_Value
Description: A True_Value value indicates that received data is to be traced.
SendPromptType: String
Default: ''
Description: Prompt to precede sent data.
ReceivePromptType: String
Default: ''
Description: Prompt to precede received data.
Return valueType: Simple String List Object
Description: Returns a Simple String List Object for trace data.

Remarks

Starts trace of FTP communication. You can trace to either a Simple String List Object or to a file on disk. It is not possible to trace to both a file and a string list at the same time. If StartTraceToFile is called followed by a StartTraceToSimpleStringList, the trace to file will end.

See Also

FTP Server Object::StartTraceToFile
FTP Server Object::StopTrace
Simple String List Object


StopTrace

Stops tracing to a file or a simple string list.

Parameters

-

See Also

FTP Server Object::StartTraceToFile
FTP Server Object::StartTraceToSimpleStringList


Status

Sends the STAT command to the server.

Parameters

PathNameType: String
Default:"
Description: See Remark below.
Return valueType: String
Default: ''
Description: String variable where the reply from the server is to be placed.

Remarks

PathName argument:
If the argument is a path name, this method is analogous to the List method. If a partial path name is given, the server may respond with a list of filenames or attributes associated with that specification. If no argument is given, the server should return general status information about the server FTP process (this should include current values of all transfer parameters and the status of connections).


List

Fetches a file directory listing.

Parameters

PathNameType: String
Default:"
Description: If empty, the current server directory is used. Property Directory.
Return valueType: IEObjectFTPListingInterface
Default: ''
Description: The FTP Listing Object to receive the directory listing.

Remark

The server sends name and supplementary information on each file found within the specified PathName.

See Also

FTP Server Object::Directory
FTP Server Object::NameList
FTP Directory Listing Object


NameList

Fetches a file directory listing with names only.

Parameters

PathNameType: String
Default:"
Description: If empty, the current server directory is used. Property Directory.
Return valueType: Simple String List Object
Description: The String List Object to receive the listing.

Remark

Gets a file directory listing without file attributes. The server sends a filename for each file found within the PathName specified.

See Also

FTP Server Object::Directory
FTP Server Object::List
Simple String List Object


ChangeDirectoryUp

Sets the working directory to the parent directory.

Parameters

-

See Also

FTP Server Object::Directory


DeleteFile

Deletes a file on the server.

Parameters

FilenamePathType: String
Description: Specifies the file to delete.

See Also

FTP Server Object::RemoveDirectory
FTP Server Object::RenameFile


RenameFile

Renames a file on the server.

Parameters

FromFilenameType: String
Description: Specifies the old filename and path.
ToFilenameType: String
Description: Specifies the new filename and path.

See Also

FTP Server Object::DeleteFile


MakeDirectory

Creates a directory on the server.

Parameters

DirectoryPathType: String
Description: Specifies the absolute or relative directory path.

See Also

FTP Server Object::RemoveDirectory


RemoveDirectory

Deletes a directory on the server.

Parameters

DirectoryPathType: String
Description: Specifies the absolute or relative directory path.

See Also

FTP Server Object::MakeDirectory


MGet

Retrieves multiple files from the server.

Parameters

SourceType: String
Description: Specifies a list of files and directories to retrieve from the server. Wildcards are allowed, and multiple paths may be specified when separated by a space. Any path with a space must be enclosed within quotes.
If using wildcards (*) -> Source is interpreted by the FTP server. The FTP server may return a recursive list of files but the directory structure will not be recreated locally.
DestinationType: ParamTypeFilepath
Description: Any path with a space must be enclosed within quotes. Must be a valid path.
FileErrors
Optional
Type: Pointer to Simple String List
Description: A Simple String List Object variable containing a list of files, with corresponding errors, that failed to be retrieved.
FilesTransferred
Optional
Type: Pointer to Simple String List
Description: A Simple String List Object variable containing a list of files that were successfully retrieved.

See Also

FTP Server Object::Store
FTP Server Object::MPut
FTP Server Object::Retrieve Simple String List Object


MPut

Stores multiple files on the server.

Parameters

SourceType: ParamTypeFilepath
Description: Specifies a list of files and directories to store on the server. Wildcards are allowed, and multiple paths may be specified when separated by a space. Any path with a space must be enclosed within quotes.

If using wildcards () -> All files matching the wildcard () will be stored in the specified directory on the FTP server.
DestinationType: String
Description: Specifies a destination directory. Any path with a space must be enclosed within quotes. Defaults to current server directory.
FileErrors
Optional
Type: Pointer to Simple String List Object
Description: A Simple String List Object variable containing a list of files, with corresponding errors, that failed to be stored.
FilesTransferred
Optional
Type: Pointer to Simple String List Object
Description: A Simple String List Object variable containing a list of files that were successfully stored.

See Also

FTP Server Object::Store
FTP Server Object::MGet
FTP Server Object::Retrieve
Simple String List Object


Store

Stores a file on the server.

Parameters

RemoteFileNameType: String
Description: Specifies the remote filename (with path) to store, store unique or append to.

Remark: If StoreType is UniquNoPrefix, specifiying a RemoteFilename will result in a runtime error.
SourceTypeType: FTPSourceType
Default: FTPSourceFilepath
Description: Type of source. Depending of the value of this parameter either parameter SourceFilename or SourceData must be filled in.
SourceFilenameType: [ParamTypeFilepath]../CommonDataTypes.md#paramtypefilepath)
Default:
Description: If parameter SourceType is FTPSourceFilepath this parameter is the filepath to the source..
SourceDataType: String
Default: ''
Description: If parameter SourceType is FTPSourceString this parameter is the data to be stored in the file.

See Also

FTP Server Object::MPut
FTP Server Object::MGet
FTP Server Object::Retrieve
FTPSourceType


Retrieve

Retrieves a file from the server.

Parameters

RemoteFileNameType: String
Default:
Description: Specifies the remote filename (with path) to retrieve.
DestTypeType: FTPDestinationType
Default: FTPDestinationFilepath
Description: Type of destination. Depending of the value of this parameter either parameter DestFilename or DestData must be filled in.
DestFilenameType: [ParamTypeFilepath]../CommonDataTypes.md#paramtypefilepath)
Default:
Description: If parameter DestType is FTPDestinationFilepath this parameter is the filepath to the destination.
DestDataType: Pointer to String
Default:
Description: If parameter DestType is FTPDestinationString this parameter is the variable where the data from the remote file is to be stored.

See Also

FTP Server Object::MPut
FTP Server Object::MGet
FTP Server Object::Store
FTPDestinationType