|
Summary
Connect to FTP server via a SOCKS firewall server.
Syntax
| Boolean FwConnect (FwServer, FwPort, Host, User, Password, Account) |
|
FwServer |
String |
|
FwPort |
Integer |
|
Host |
String |
|
User |
String |
|
Password |
String |
|
Account |
String |
Description
The FwConnect method establishes a connection to the FTP server via a firewall.
If the FTP Client machine is located on a different subnet than the remote FTP Server machine and the only form of communication between these two machines is through a firewall gateway, then the
built-in firewall support of the FTP Client ActiveX control can be used to established an FTP session.
The FwConnect method takes a firewall server name (FwServer), a firewall port (FwPort), a host name (Host), a user name (User), a password (Password) and
an account (Account) as its parameters and returns a boolean. FwServer must be the name or internet address (in dotted decimal notation) of the firewall server. FwPort must
be the firewall service port. Host must be the name or internet address (in dotted decimal notation) of the FTP server. If the Host is the internet address then the
FwAddrType property must be set to FW_ADDR_IP4 and if it is a machine name then the FwAddrType property must be set to FW_ADDR_DNS, by default the FwAddrType property has
the value FW_ADDR_IP4. The FwUsername and FwPassword properties must contain a valid user name and password to complete the login process. Some servers also require that
Account contain the name of an account for the user. If the server does not require the name of an account for the user, then Account can be set to an empty string.
The application can also set the FwAuthMethods property if it wants to specify any authentication that needs to be negotiated before an actual connection is established. Only the
Username/Password authentication is currently supported. If Username/Password authentication is specified the FwUsername and FwPassword properties should contain a valid username
and password respectively. An authentication is only possible if the SOCKS version is 5; version 4 SOCKS server does not support any authentication protocols.
The version of the SOCKS server can be specified in the FwSocksVer property, if the server version is unknown then the application can set this property to both FW_VERSION4 and FW_VERSION5,
and the Distinct FTP ActiveX control will automatically detect the SOCKS version and connect appropriately.
If a connection is successfully established, then the method returns True; otherwise, it returns False. The application should ensure that the method was successfully executed by checking the return
value. The method also sets the LastResult property. The value of the LastResult property can be checked to determine if any error occurred.
If the connection can be established, then the OnConnect event will be fired. If the connection cannot be established, then the OnError event will be fired. These events will occur before the next
statement (i.e. the statement following the call to the FwConnect method) is executed. The application should set a flag in the OnConnect and OnError events, so that it can determine if the session
has been established or not. In addition, the application may want to display an error message in the OnError event to inform the user that the connection has not been established. Please check the
reference page of the OnError event for a complete listing of error codes.
Calling this method is equivalent to setting the Action property to ACTION_FW_CONNECT.
Note
If you need to connect through an HTTP proxy server, you must set the proxy properties and call the Connect method instead.
Example
Result = FTPClient.FwConnect ("sparky.distinct.com", 1080, "speedy.distinct.com", "santa", "north pole", "sc001d") If Result = False Then MsgBox "Unable
to connect to server via a firewall", 64, "Sample Program" End If
|