Search /
Docfinder:
Advanced search  |  Help  |  Site map
RESEARCH CENTERS
SITE RESOURCES
Click for Layer 8! No, really, click NOW!
Networking for Small Business
TODAY'S NEWS
Four reasons to buy (and one reason to avoid) the Droid
Cisco MARS shuts out new third-party security devices
Verizon Droid buzz muted in Boston
Week in Google news: Google Dashboard, Droid fever, focus on e-commerce
Cloud computing, virtualization proponents getting antsy
Data center start-up offers energy saving software
Vendors scrambling to fix bug in Net's security
Judge dismisses lawsuit challenging Gartner's Magic Quadrant
Boston Celtics clamp down on spam
Cloud computing inevitable? Not so fast, educator says
Blue Coat slashes staff, buys S7 services company
Apple seeks new sheriff to lock up iPhones
Google releases new search engine for e-commerce sites
Rackspace apologizes for cloud outage, prepares to issue service credits
Applications /

Still more FTPing

Gearhead archive

So last week in our discussion of FTP we tried to get to the point where we send and receive files but we got sidetracked by transfer modes. This week we really will get to move files around.

To recapitulate: We have connected, authenticated (commands USER and PASS), changed directories (CWD), set the translation type to ASCII (TYPE A), listed the current directory (LIST), set the translation type to image (TYPE I), and set the transfer to be passive (PASV, specifying that we will access a server-defined port for the data transfer -remember that commands are issued on port 21 and data transfers are performed on some other port specified by the FTP client or the FTP server).

We've left the transmission mode to default to stream (the command we won't send would be MODE S) and so now, let's transfer a file:

RETR myfile.zip
150 Opening image mode data connection for myfile.zip.
226 Transfer complete.

On our end, after the command and before the 226 response, we had to open the server port, start reading data from the port and store the data in a file. As we discussed last week, in stream mode the end of a file is signified by the stream ending - the server closes the connection and we assume that signifies the end of file, unless of course the transfer got garbled. Usually this is not a problem, but if your connection suffers packet loss you might need to use block or compressed mode if the client and server support them.

Sending a file is much the same except we use the STOR command:

STOR myfile.zip
150 Opening image mode data connection for myfile.zip.
226 Transfer complete.

If you want to stop the current file transfer, you just need to issue an abort (ABOR) command. Then there is the no operation (NOOP) command that tells the server the client is still alive. Most FTP clients use this command to keep the current session alive (that is, so you don't have to keep logging on).

Manipulating files is pretty straightforward: Changing file names is done with the "rename from" and "rename to" commands (the latter must immediately follow the former), thus:

RNFR myfile.zip
350 File exists, ready for destination name
RNTO myfile2.zip
250 RNTO command successful.

Other useful commands are delete (DELE ), remove directory (RMD ) and make directory (MKD ). If your client gets into a mess or you need to restart the connection to an FTP server for any reason, you can reinitialize (REIN), which logs you out so, not surprisingly, the next command really should be the user name command (USER) followed by the password command (PASS).

Finally, if you want to end your session with the server, you should issue the logout (QUIT) command (although if there's no data transfer in progress, simply dropping the connection will have the same effect but faster).

FTP is a reasonably straightforward protocol, and if you want to get deeper into FTP technology check out the FTP Protocol Resource Center

Transfer your thoughts to gearhead@gibbs.com

RELATED LINKS

Comments and suggestions to gh@gibbs.com.

Gibbs Forum
The place to discuss Gibbs's columns.

Check out this week's edition of

Backspin for more musings from Gibbs.

Part 1: Intro to FTP
Network World, 7/23/01.

Part 2: The connection to the server is made
Network World, 7/30/01.

Part 3: Connection modes
Network World, 8/6/01.

Part 5: FTP server security
Network World, 8/20/01.

Part 6: SITE and SYST
Network World, 8/27/01.

Comments and suggestions to gh@gibbs.com.

Gibbs Forum
The place to discuss Gibbs's columns.

Check out this week's edition of

Backspin for more musings from Gibbs.


NWFusion offers more than 40 FREE technology-specific email newsletters in key network technology areas such as NSM, VPNs, Convergence, Security and more.
Click here to sign up!
New Event - WANs: Optimizing Your Network Now.
Hear from the experts about the innovations that are already starting to shake up the WAN world. Free Network World Technology Tour and Expo in Dallas, San Francisco, Washington DC, and New York.
Attend FREE
Your FREE Network World subscription will also include breaking news and information on wireless, storage, infrastructure, carriers and SPs, enterprise applications, videoconferencing, plus product reviews, technology insiders, management surveys and technology updates - GET IT NOW.
* HOME    * RESEARCH CENTERS     * NEWS     * EVENTS

Contact us | Terms of Service/Privacy | How to Advertise
Reprints and links | Partnerships | Subscribe to NW
About Network World, Inc.

Copyright, 1994-2006 Network World, Inc. All rights reserved.