The SocketTools File Transfer Protocol (FTP) control enables an application to upload or download files from a remote host and perform a variety of remote file management functions. Using the control, an application can create, rename and delete files and directories, list files and search for files using wildcards. The control provides both high level methods, such as the ability to transfer multiple files in a single method call, as well as access to lower level remote file I/O methods. To download a free evaluation copy of SocketTools or for more information about this component, please select one of the following links:
The File Transfer Protocol control provides a comprehensive interface which supports both high level operations, such as uploading or downloading files, as well as a collection of lower-level file I/O methods. In addition to file transfers, an application can create, rename and delete files and directories, search for files using wildcards, and so on. The control can be generally broken down into three distinct groups of functionality:
Methods which enable an application to upload and download files, as well as send and receive file data using strings or byte array buffers. For example, the GetFile method is used to download a file from the server and store the data in a file on the local system. On the other hand, the GetData method will download a file from the server and store the contents of that file in a string or byte array. This gives your program the flexibility of handling the data either on disk or in memory, depending on the best needs of your application. If your program needs to transfer multiple files at once, there are the GetMultipleFiles and PutMultipleFiles methods which will automatically download or upload two or more files in a single function call.
In addition to transferring files, the control can be used to manage files on the server. Methods are provided to delete, rename and move files between directories. For servers that support specific protocol extensions, advanced features such as getting or setting a remote file's modification time or access permissions are also supported. If a server supports site-specific commands, such as the ability to submit a file as job on the server, the control also supports this by enabling you to send custom commands to the server and then process the information that it returns.
The control can be used to manage directories as well as files on the server. The application can open a directory and return a list of the files that it contains, as well as create new directories and delete empty ones. The control understands a number of different directory listing formats, including those typically used on UNIX and Linux based systems, Windows server platforms and VMS systems.
This control also supports secure file transfers using the standard SSL and TLS protocols. Both implicit and explicit SSL connections can be established, enabling the control to work with a wide variety of security-enabled servers. A SocketTools Secure Visual Edition license must be purchased to use the security features in this control.
The following are just some of the features in the SocketTools File Transfer Protocol control:
The following code example in Visual Basic demonstrates how the control can be used to download a file from a file server and return the results in a file on the local system:
' Specify the URL to the resource that we wish to retrieve
' and the name of the local file it will be downloaded to
strRemoteFile = "ftp://ftp.server.com/filename.zip"
strLocalFile = "c:\temp\filename.zip"
' Download the file to the local system
nError = FtpClient1.GetFile(strRemoteFile, strLocalFile)
If nError > 0 Then
MsgBox FtpClient1.LastErrorString, vbExclamation
Exit Sub
End If
In this example, the GetFile method is used to download the file and store it on the local system. By providing the method with a complete URL, it automatically establishes the connection, retrieves the file and then disconnects from the server when the transfer has completed. If your application needs to download several files from the same server, then the control also supports persistent connections by using the Connect method.
As you can see, most of the code is actually related to error checking and comments, with only one line of code required to retrieve the file from the server. If you wanted to store the contents of the remote file in memory instead of creating a file on the local system, then you would use the GetData method instead, but all of the other code would remain the same.
Product Overview
An overview of the product features and benefits.
SocketTools Controls
The ActiveX controls that are included with this edition.
Frequently Asked Questions
Answers to the most common questions about SocketTools.
Download Product
Download a free evaluation copy of SocketTools.
Purchase Online
Purchase a developers license for this product.
Technical Reference
Review the online technical reference documentation.
Release Notes
Release notes for the current version of SocketTools.
License Agreement
The developer license agreement for this product.