| Supported Protocols | |||||||||||
|
The File Transfer control is designed to minimize the differences between FTP and HTTP transfers, and to present a consistent and uniform interface. In general, the type of server that you use will be determined by your application. Regardless of which protocol you use, the procedure that you will use will usually belong to one of the following two patterns:
Service PortsBy convention, most servers listen on the following ports:
If you leave the ServerPort property at its default value of zero, then the FileTransfer control will automatically select the port according to the value of the ServerType and Secure properties. However, you can override the standard port values by setting the ServerPort property. This enables your application to establish a connection with a server that is configured to use non-standard port numbers. AuthenticationFTP servers generally require a user name and password in order to transfer or manage files during a session. Many servers support anonymous logins, in which a user name and password must still be supplied, but are not authenticated. If no user name and password are provided when establishing a connection, the control will use anonymous authentication by default. HTTP servers generally do not require a user name and password in order to download files, but may require authentication when uploading files. By default, the File Transfer control encodes the user name and password for HTTP according to the Basic Authentication scheme. Proxy ServersIn certain environments, connection to an FTP or HTTP server must be made explicitly through a proxy server. The File Transfer control supports this with a set of properties (ProxyType, ProxyServer, ProxyPort, ProxyUser, ProxyPassword) that must be set before attempting a connection. If the ProxyType is nonzero, then the remaining proxy-related properties are used by the control. There is greater variation among proxies used for FTP than is the case for HTTP. If an FTP proxy is encountered that does not fall into one of the categories explicitly supported by the control, then the fileProxyOther proxy type should be used, and the Command method should be used to send any custom commands that are required to authenticate the user in accordance with instructions provided by the proxy vendor. Uploading FilesThe File Transfer Protocol supports uploading files from the client to the server in a universally implemented manner. The only limitations are those imposed by the server administrator and the access rights of the authenticated user. Uploading files using the Hypertext Transfer Protocol can be more complicated because there are several different methods that are used and not all servers are configured to support file uploads. File uploads are typically implemented using either the PUT or POST command. Most web servers do not support the use of the PUT command by default. Those servers that do support the command usually require that the client be authenticated prior to permitting the transfer. The control's PutFile method uses this command. The POST command is a more common method of uploading a file and it is what's used when a form displays a button that allows the user to browse for a file on the local system and then submit it to the web server for processing. The control's PostFile method uses this command. Note that the File Transfer control does not provide extensive support for submitting form data. For advanced functionality such as creating a virtual form and submitting the data to the server, it is recommended that you use the SocketTools component instead. Secure ConnectionsThe File Transfer Control supports secure connections using the standard SSL (Secure Sockets Layer) and TLS (Transport Layer Security) protocols. Typically you only need to set the Secure property to a value of true prior to establishing the connection or transferring the file. In some cases, a FTP server may require that you also set the Options property and specify the value fileOptionSecureExplicit. This tells the control that the server requires an explicit SSL session, where the initial connection is performed over a standard, unencrypted channel and then a secure session is negotiated. If the server supports secure connections on port 21 (the standard, non-secure port) then most likely it will require that this option be specified. If you do not know if the server requires implicit or explicit SSL connections, contact the server administrator. PersistenceWhen using the File Transfer Protocol, any number of file transfers may be performed during a single session. There are actually two connections established during a session. The first is the command channel which is used to authenticate the session and issue commands. The second is the data channel, which is used during the actual data transfer during a file upload or download. The Hypertext Transfer Protocol may use either transient or persistent connections. The KeepAlive property enables the application to indicate to the server whether or not the connection should persist. However, it is important to note that the server may choose to close the connection even if the client requests a persistent connection. If this occurs, the control will automatically attempt to reconnect to the server, but the application must be prepared to handle any potential errors when requesting multiple files from a web server. |
|||||||||||
|
Copyright © 2008 Catalyst Development Corporation. All rights reserved. |
|||||||||||