O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Access an FTP Site

Problem

You want to retrieve or upload files from an FTP server.

Solution

Use a third-party component, or create a dedicated class that sends FTP commands over a TCP connection.

Discussion

FTP (File Transfer Protocol) is a common protocol used to upload and download files from a server. FTP, like many Internet protocols, defines a small set of commands that are sent as simple ASCII-encoded messages over a TCP connection (typically on port 21).

The following is a listing of a typical FTP dialogue, starting immediately after the client makes a TCP connection. Notice that every line sent from the server begins with an FTP response code.

Server sends: 220-FTP server ready. Server sends: 220-<< Server sends: 220- Server sends: 220->> Server ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required