Please Whitelist This Site?

I know everyone hates ads. But please understand that I am providing premium content for free that takes hundreds of hours of time to research and write. I don't want to go to a pay-only model like some sites, but when more and more people block ads, I end up working for free. And I have a family to support, just like you. :)

If you like The TCP/IP Guide, please consider the download version. It's priced very economically and you can read all of it in a convenient format without ads.

If you want to use this site for free, I'd be grateful if you could add the site to the whitelist for Adblock. To do so, just open the Adblock menu and select "Disable on tcpipguide.com". Or go to the Tools menu and select "Adblock Plus Preferences...". Then click "Add Filter..." at the bottom, and add this string: "@@||tcpipguide.com^$document". Then just click OK.

Thanks for your understanding!

Sincerely, Charles Kozierok
Author and Publisher, The TCP/IP Guide


NOTE: Using software to mass-download the site degrades the server and is prohibited.
If you want to read The TCP/IP Guide offline, please consider licensing it. Thank you.

The Book is Here... and Now On Sale!

Get The TCP/IP Guide for your own computer.
The TCP/IP Guide

Custom Search







Table Of Contents  The TCP/IP Guide
 9  TCP/IP Application Layer Protocols, Services and Applications (OSI Layers 5, 6 and 7)
      9  TCP/IP Key Applications and Application Protocols
           9  TCP/IP File and Message Transfer Applications and Protocols (FTP, TFTP, Electronic Mail, USENET, HTTP/WWW, Gopher)
                9  TCP/IP General File Transfer Protocols (FTP and TFTP)
                     9  File Transfer Protocol (FTP)
                          9  FTP Concepts and General Operation

Previous Topic/Section
FTP General Data Communication and Transmission Modes
Previous Page
Pages in Current Topic/Section
1
2
3
Next Page
FTP Commands and Replies
Next Topic/Section

FTP Data Representation: Data Types, Data Structures and Format Control
(Page 2 of 3)

ASCII Data Type Line Delimiting Issues

When the ASCII data type is used, differences in internal representations between systems are handled by using a universal external representation that acts as a “common language”. Lines of the file being transmitted are converted by the sending FTP process from the sender's internal representation to the neutral ASCII representation used by the Telnet protocol (“NETASCII”) with each line ending in “CR+LF”. The receiving device then converts from this neutral representation to the internal format used by the recipient file system.

For example, when using FTP to move a text file from a Macintosh to a UNIX system, each line would have the “CR” changed to a “CR+LF” for transmission over the FTP data channel. The receiving UNIX system would change each “CR+LF” to just “LF”, so UNIX programs would read it properly.

Note that this actually does mean the resulting file can be bigger or smaller than the original, if it is transferred between systems using ASCII mode. Also, since FTP works by converting to a neutral representation for universality, sending an ASCII file from a UNIX system to a UNIX system means each “LF” is changed to “CR+LF” for transmission, then changed back to just “LF” by the recipient. Slightly inefficient, but not that big a deal.

It's very important that when FTP is used, the correct data type be specified with the appropriate user command. Sending a text file between dissimilar systems without setting ASCII mode will result in either a file that cannot be properly read on the destination, or one that has stray characters in it. Conversely, binary files must be sent in binary mode. If you send something like a ZIP file or a JPG graphic in ASCII mode, the FTP software will think it is a text file. It will treat the file as if it were text, and each time it encounters bytes in the file that look like “CR”, “LF” or “CR+LF” it will convert them, which you do not want. (Having the wrong data type set is a leading cause of corrupted files when using FTP to move files between PCs and UNIX systems. I know from experience!)

Key Concept: FTP defines four data types: ASCII, EBCDIC, image and local. ASCII and EBCDIC are used for text files in the ASCII and EBCDIC character sets, respectively; the image type is used for files with no specific structure, and the local type for local representation. The ASCII type is important because it allows text files to be transferred successfully between file systems that may use different methods of indicating the end of a line of text. The image type, also called binary, is used for files that must be sent and received byte-for-byte with no transformation, such as executable files, graphics and files with arbitrary formats.



Previous Topic/Section
FTP General Data Communication and Transmission Modes
Previous Page
Pages in Current Topic/Section
1
2
3
Next Page
FTP Commands and Replies
Next Topic/Section

If you find The TCP/IP Guide useful, please consider making a small Paypal donation to help the site, using one of the buttons below. You can also donate a custom amount using the far right button (not less than $1 please, or PayPal gets most/all of your money!) In lieu of a larger donation, you may wish to consider purchasing a download license of The TCP/IP Guide. Thanks for your support!
Donate $2
Donate $5
Donate $10
Donate $20
Donate $30
Donate: $



Home - Table Of Contents - Contact Us

The TCP/IP Guide (http://www.TCPIPGuide.com)
Version 3.0 - Version Date: September 20, 2005

© Copyright 2001-2005 Charles M. Kozierok. All Rights Reserved.
Not responsible for any loss resulting from the use of this site.