In this chapter, we'll examine the powerful capabilities of Visual Basic to handle two important Internet protocols: File Transfer Protocol (FTP) and Hypertext Transfer Protocol (HTTP). FTP is usually used to transfer large files; most Internet servers have an FTP area that you can examine and upload files to or download files from. The HTTP protocol is the basis of the World Wide Web and is usually used to fetch Web pages; you get the direct HTML of a Web page using this protocol. Like the FTP protocol, HTTP can also be used to get binary files (such as images or .zip files). Visual Basic's built-in support for these methods makes writing programs around them almost easy. In this chapter, we'll write a program that reads the directory of an FTP site and allows us to get both binary and text data. We'll also create an HTTP program that fetches a Web page and displays its HTML. (This is unlike the WebBrowser control, which displays the Web page without the underlying HTML.)
You can also get creative with these methods. For example, you might use FTP methods in your programs to automatically download documentation for a user who clicks items in the Help menu. Or you could use HTTP methods to write a program that gets all the graphics images from a Web page without having to click each one.
Visual Basic uses the Internet Transfer control to handle these two protocols, so let's take a look at this exceptionally powerful control first.