ChannelMode Property  
 

Gets and sets the security mode for the specified communications channel.

Syntax

object.ChannelMode(channel) [= mode ]

Remarks

The ChannelMode property property array is used to change the security mode for either the command or data channel. The property array index specifies the channel that should be changed, and may be one of the following values:

Value Constant Description
0 ftpChannelCommand Change or return information for the command channel. This is the communication channel used to send commands to the server and receive command result and status information from the server.
1 ftpChannelData Change information for the data channel. This is the communication channel used to send or receive data during a file transfer.

The mode value specifies the new security mode for the specified channel. It may be one of the following values:

Value Constant Description
0 ftpChannelClear Data sent and received on this channel should not be encrypted.
1 ftpChannelSecure Data sent and received on this channel should be encrypted. Specifying this option requires that a secure connection has already been established with the server.

The ChannelMode property array is used to change the default mode for the specified channel, and is typically used to control whether or not data is encrypted during a file transfer. If a standard, non-secure connection has been established with the server, an error will be returned if you specify the ftpChannelSecure mode for either channel.

If you have established a secure connection and then specify the ftpChannelClear mode for the command channel, the client will send the CCC command to the server to indicate that commands should no longer be encrypted. If the server does not support this command, an error will be returned and the channel mode will remain unchanged. Once the command channel has been changed to clear mode, it cannot be changed back to secure mode. You must disconnect and re-connect to the server if you want to resume sending commands over an encrypted channel.

Changing the mode for the data channel requires that the server support the PROT command. If this command is not supported by the server, an exception will be thrown which must be handled by the application. You can only set a channel to secure mode if the Secure property is also set to True.

It is important to note that this property array should only be used after a connection has been established with the server. If you attempt to read the property or change a value prior to calling the Connect method, an exception will be thrown.

Data Type

Integer (Int32)

See Also

Features Property, Secure Property, Connect Method, Disconnect Method