ActivePort Property  
 

Gets and sets the range of local port numbers used for active mode file transfers.

Syntax

object.ActivePort(portrange) [ = localport ]

Remarks

The ActivePort property property array is used to change the range of local port numbers used for active mode file transfers. The property array index specifies the port that should be changed, and may be one of the following values:

Value Constant Description
0 ftpActivePortLow Change or return information for the low port number.
1 ftpActivePortHigh Change or return information for the high port number.

The localport value specifies the new port number to be used. Valid port numbers are in the range of 1025 through 65535.

This property array is used to modify the range of local port numbers used for active mode file transfers. When using active mode, the client listens for an inbound connection from the server rather than establishing an outbound connection for the data transfer. In most cases, passive mode transfers are preferred because they mitigate potential compatibility issues with firewalls and NAT routers.

If active mode transfers are required, the default port range used when listening for the server connection is between 1024 and 5000. This is the standard range of ephemeral ports used by the Windows operating system. However, under some circumstances that range of ports may be too small, or a firewall may be configured to deny inbound connections on ephemeral ports. In that case, the ActivePort property can be used to specify a different range of port numbers.

While it is technically permissible to assign the low and high port numbers to the same value, effectively specifying a single active port number, this is not recommended as it can cause the transfer to fail unexpectedly if multiple file transfers are performed. A minimum range of at least 1000 ports is recommended. For example, if you specify a low port value of 40000 then it is recommended that the high port value be at least 41000. The maximum port value is 65535.

Data Type

Integer (Int32)

See Also

Features Property, Connect Method, Disconnect Method