0% found this document useful (0 votes)
25 views28 pages

HTTP and FTP

Uploaded by

gautham1234123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views28 pages

HTTP and FTP

Uploaded by

gautham1234123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 28

TABLE OF CONTENTS

Brief note on HTTP...............................................................................................................................2


Breifly explain persistant and inpersisitant connections........................................................................7
Write difference between persistant and inpersistant connections.......................................................11
Explain briefly FTP.............................................................................................................................13
Explain FTP with commands and replies............................................................................................15
With a flow diagram Explain how a file will be transfered between client and server.........................17
Hierarchical Domain Name Structure..................................................................................................21
Components of DNS............................................................................................................................21
DNS Servers.........................................................................................................................................22
Resource Records (RRs).......................................................................................................................22
DNS Resolution Process.......................................................................................................................23
Caching................................................................................................................................................24
Dynamic DNS (DDNS)...........................................................................................................................24
Security Considerations.......................................................................................................................24
Brief note on cookies...........................................................................................................................25
Brief note on HTTP
HyperText Transfer Protocol (HTTP)
The HyperText Transfer Protocol (HTTP) is used to define how the client-server
programs can be written to retrieve web pages from the Web.
An HTTP client sends arequest; an HTTP server returns a response. The server uses the port number
80; the client uses a temporary port number. HTTP uses the services of TCP, which, as discussed
before, is a connection-oriented and reliable protocol.
This means that, before anytransaction between the client and the server can take place, a connection
needs to be established between them.
After the transaction, the connection should be terminated.
The client and server, however, do not need to worry about errors in messages
exchanged or loss of any message, because the TCP is reliable and will take care of thismatter.
HTTP supports proxy servers.
HTTP per se does not provide security. However, as we show in Chapter 32, HTTP can
be run over the Secure Socket Layer (SSL). In this case, HTTP is referred to as HTTPS.
HTTPS provides confidentiality, client and server authentication, and data integrity.
Nonpersistent versus Persistent Connections
the hypertext concept embedded in web page documents may require several requests and responses.
If the web pages, objects to beretrieved, are located on different servers, we do not have any other
choice than to cre-ate a new TCP connection for retrieving each object. However, if some of the
objects are located on the same server, we have two choices: to retrieve each object using a new TCP
connection or to make a TCP connection and retrieve them all. The first method is
referred to as a nonpersistent connection, the second as a persistent connection. HTTP,
prior to version 1.1, specified nonpersistent connections, while persistent connections
are the default in version 1.1, but it can be changed by the user.
Nonpersistent Connections
In a nonpersistent connection, one TCP connection is made for each request/response.
The following lists the steps in this strategy:
1. The client opens a TCP connection and sends a request.
2. The server sends the response and closes the connection.
3. The client reads the data until it encounters an end-of-file marker; it then closes the
connection.
Message Formats
The HTTP protocol defines the format of the request and response messages, as shown
in Figure 26.5. We have put the two formats next to each other for comparison. Each
message is made of four sections. The first section in the request message is called the
request line; the first section in the response message is called the status line. The other
three sections have the same names in the request and response messages. However, the
similarities between these sections are only in the names; they may have different con-
tents. We discuss each message type separately.

Request Message
As we said before, the first line in a request message is called a request line. There are
three fields in this line separated by one space and terminated by two characters (car-
riage return and line feed) as shown in Figure 26.5. The fields are called method, URL,
and version.
The method field defines the request types. In version 1.1 of HTTP, several
methods are defined, as shown in Table 26.1. Most of the time, the client uses the
GET method to send a request. In this case, the body of the message is empty. The
HEAD method is used when the client needs only some information about the web
page from the server, such as the last time it was modified. It can also be used to test
the validity of a URL. The response message in this case has only the header section;
the body section is empty. The PUT method is the inverse of the GET method; it
allows the client to post a new web page on the server (if permitted). The POST
method is similar to the PUT method, but it is used to send some information to the
server to be added to the web page or to modify the web page. The TRACE method is
used for debugging; the client asks the server to echo back the request to check
whether the server is getting the requests. The DELETE method allows the client to
delete a web page on the server if the client has permission to do so. The CONNECT
method was originally made as a reserve method; it may be used by proxy servers, as

discussed later. Finally, the OPTIONS method allows the client to ask about the prop-
erties of a web page.

The second field, URL, It defines the addressand name of the corresponding web page. The third
field, version, gives the version of the protocol; the most current version of HTTP is 1.1.
After the request line, we can have zero or more request header lines. Each
header line sends additional information from the client to the server. For example,
the client can request that the document be sent in a special format. Each header line
has a header name, a colon, a space, and a header value (see Figure 26.5). Table 26.2
shows some header names commonly used in a request. The value field defines the
values associated with each header name. The list of values can be found in the corre-
sponding RFCs.The body can be present in a request message. Usually, it contains the comment
to be sent or the file to be published on the website when the method is PUT or
POST.
Response Message

The format of the response message is also shown in Figure 26.5. A response mes-
sage consists of a status line, header lines, a blank line, and sometimes a body. The
first line in a response message is called the status line. There are three fields in this
line separated by spaces and terminated by a carriage return and line feed. The first
field defines the version of HTTP protocol, currently 1.1. The status code field
defines the status of the request. It consists of three digits. Whereas the codes in the
100 range are only informational, the codes in the 200 range indicate a successful
request. The codes in the 300 range redirect the client to another URL, and the codes
in the 400 range indicate an error at the client site. Finally, the codes in the 500 range
indicate an error at the server site. The status phrase explains the status code in text
form.After the status line, we can have zero or more response header lines. Each header
line sends additional information from the server to the client. For example, the sender
can send extra information about the document. Each header line has a header name, a
colon, a space, and a header value. We will show some header lines in the examples at
the end of this section. Table 26.3 shows some header names commonly used in a
response message.
---------------------------------------------------------------------------------------------------------------------------
Breifly explain persistant and inpersisitant connections

Nonpersistent versus Persistent Connections


the hypertext concept embedded in web page documents may require several requests and responses.
If the web pages, objects to beretrieved, are located on different servers, we do not have any other
choice than to cre-ate a new TCP connection for retrieving each object. However, if some of the
objects are located on the same server, we have two choices: to retrieve each object using a new TCP
connection or to make a TCP connection and retrieve them all. The first method is
referred to as a nonpersistent connection, the second as a persistent connection. HTTP,
prior to version 1.1, specified nonpersistent connections, while persistent connections
are the default in version 1.1, but it can be changed by the user.
Nonpersistent Connections
In a nonpersistent connection, one TCP connection is made for each request/response.
The following lists the steps in this strategy:
1. The client opens a TCP connection and sends a request.
2. The server sends the response and closes the connection.
3. The client reads the data until it encounters an end-of-file marker; it then closes the
connection.
In this strategy, if a file contains links to N different pictures in different files (all
located on the same server), the connection must be opened and closed N + 1 times.
The nonpersistent strategy imposes high overhead on the server because the server
needs N + 1 different buffers each time a connection is opened.
Example 26.3
Figure 26.3 shows an example of a nonpersistent connection. The client needs to access a file that
contains one link to an image. The text file and image are located on the same server. Here we
need two connections. For each connection, TCP requires at least three handshake messages to
establish the connection, but the request can be sent with the third one. After the connection is
established, the object can be transferred. After receiving an object, another three handshake
messages are needed to terminate the connection. This means that the
client and server are involved in two connection establishments and two connection terminations.
If the transaction involves retrieving 10 or 20 objects, the round trip times spent for these hand-
shakes add up to a big overhead. When we describe the client-server programming at the end of
the chapter, we will show that for each connection the client and server need to allocate extra
resources such as buffers and variables. This is another burden on both sites, but especially on the
server site.
Persistent Connections
HTTP version 1.1 specifies a persistent connection by default. In a persistent connec-tion, the server
leaves the connection open for more requests after sending a response.
The server can close the connection at the request of a client or if a time-out has been
reached. The sender usually sends the length of the data with each response. However,
there are some occasions when the sender does not know the length of the data. This is
the case when a document is created dynamically or actively. In these cases, the server
informs the client that the length is not known and closes the connection after sending
the data so the client knows that the end of the data has been reached. Time and
resources are saved using persistent connections. Only one set of buffers and variables
needs to be set for the connection at each site. The round trip time for connection estab-
lishment and connection termination is saved.

Example 26.4
Figure 26.4 shows the same scenario as in Example 26.3, but using a persistent connection.
Only one connection establishment and connection termination is used, but the request for the
image is sent separately.
File Transfer Protocol (FTP) is the standard protocol provided by TCP/IP for copy-
ing a file from one host to another. Although transferring files from one system to

another seems simple and straightforward, some problems must be dealt with first.
For example, two systems may use different file name conventions. Two systems may
have different ways to represent data. Two systems may have different directory

structures. All of these problems have been solved by FTP in a very simple and ele-
gant approach. Although we can transfer files using HTTP, FTP is a better choice to

transfer large files or to transfer files using different formats. Figure 26.10 shows that.
---------------------------------------------------------------------------------------------------------------------------
Write difference between persistant and inpersistant connections
Nonpersistent Connections
 Definition: A new TCP connection is established for each request/response pair.
 Process:
1. The client opens a TCP connection and sends a request.
2. The server processes the request and sends back the response.
3. The server closes the connection after sending the response.
4. The client reads the data until the end-of-file marker and then closes its connection.
 Characteristics:
o Each resource requires its own connection, leading to higher latency and overhead.

o Suitable for simple requests but inefficient for pages with multiple resources.

Persistent Connections
 Definition: A single TCP connection can handle multiple request/response pairs.
 Process:
1. The client opens a TCP connection and sends a request.
2. The server sends back the response.
3. The connection remains open for additional requests and responses.
4. The connection is only closed when no further requests are expected (typically after a
timeout).
 Characteristics:
o Reduces latency by allowing multiple requests without needing to establish a new
connection each time.
o More efficient in resource usage, as fewer connections are opened and closed.

o The default behavior in HTTP/1.1, but users can opt for nonpersistent connections if
desired.
Differences

Feature Nonpersistent Connections Persistent Connections

Connection per No (one connection for multiple


Yes (one connection per request)
Request requests)

Lower due to reusing the same


Latency Higher due to multiple connections
connection

Higher (more connections


Resource Usage Lower (fewer connections)
opened/closed)
Feature Nonpersistent Connections Persistent Connections

Default in HTTP Prior to HTTP/1.1 HTTP/1.1 and later

Complex pages with multiple


Use Case Simple pages with few resources
resources

This comparison illustrates how persistent connections improve efficiency in handling multiple
requests, making them more suitable for modern web browsing.
---------------------------------------------------------------------------------------------------------------------------
Explain briefly FTP
File Transfer Protocol (FTP) is the standard protocol provided by TCP/IP for copy-ing a file from one
host to another. Although transferring files from one system to
another seems simple and straightforward, some problems must be dealt with first.
For example, two systems may use different file name conventions. Two systems may
have different ways to represent data. Two systems may have different directory
structures. All of these problems have been solved by FTP in a very simple and ele-gant approach.
Although we can transfer files using HTTP, FTP is a better choice totransfer large files or to transfer
files using different formats.

Figure 26.10 shows the basic model of FTP. The client has three components: the user interface, the
client control process, and the client data transfer process. The server has two components:
the server control process and the server data transfer process. The control connec-tion is made
between the control processes. The data connection is made between the data transfer processes.
Separation of commands and data transfer makes FTP more efficient. The control
connection uses very simple rules of communication. We need to transfer only a line of
command or a line of response at a time. The data connection, on the other hand, needs
more complex rules due to the variety of data types transferred.basic model of FTP. The client has
three components: the user interface, the client
control process, and the client data transfer process. The server has two components:
the server control process and the server data transfer process. The control connection is made
between the control processes. The data connection is made between the
data transfer processes.Separation of commands and data transfer makes FTP more efficient. The
control connection uses very simple rules of communication. We need to transfer only a line of
command or a line of response at a time. The data connection, on the other hand, needs more
complex rules due to the variety of data types transferred.
26.2.1 Two Connections
The two connections in FTP have different lifetimes. The control connection remains
connected during the entire interactive FTP session. The data connection is opened and
then closed for each file transfer activity. It opens each time commands that involve
transferring files are used, and it closes when the file is transferred. In other words,
when a user starts an FTP session, the control connection opens. While the control connection is open,
the data connection can be opened and closed multiple times if several
files are transferred. FTP uses two well-known TCP ports: port 21 is used for the con-trol connection,
and port 20 is used for the data connection.
26.2.2 Control Connection
For control communication, FTP uses the same approach as TELNET (discussed later).
It uses the NVT ASCII character set as used by TELNET. Communication is achieved
through commands and responses. This simple method is adequate for the control con-
nection because we send one command (or response) at a time. Each line is terminated
with a two-character (carriage return and line feed) end-of-line token.
During this control connection, commands are sent from the client to the server and
responses are sent from the server to the client. Commands, which are sent from the FTP
client control process, are in the form of ASCII uppercase, which may or may not be followed by an
argument.
26.2.3 Data Connection
The data connection uses the well-known port 20 at the server site. However, the creation of a data
connection is different from the control connection. The following
shows the steps:
1. The client, not the server, issues a passive open using an ephemeral port. This must be
done by the client because it is the client that issues the commands for transferring files.
2. Using the PORT command the client sends this port number to the server.
3. The server receives the port number and issues an active open using the well-
known port 20 and the received ephemeral port number.
Explain FTP with commands and replies
File Transfer Protocol (FTP) is the standard protocol provided by TCP/IP for copy-ing a file from one
host to another. Although transferring files from one system to
another seems simple and straightforward, some problems must be dealt with first.
For example, two systems may use different file name conventions. Two systems may
have different ways to represent data. Two systems may have different directory
structures. All of these problems have been solved by FTP in a very simple and ele-gant approach.
Although we can transfer files using HTTP, FTP is a better choice totransfer large files or to transfer
files using different formats.

Figure 26.10 shows the basic model of FTP. The client has three components: the user interface, the
client control process, and the client data transfer process. The server has two components:
the server control process and the server data transfer process. The control connec-tion is made
between the control processes. The data connection is made between the data transfer processes.
Separation of commands and data transfer makes FTP more efficient. The control
connection uses very simple rules of communication. We need to transfer only a line of
command or a line of response at a time. The data connection, on the other hand, needs
more complex rules due to the variety of data types transferred.basic model of FTP. The client has
three components: the user interface, the client
control process, and the client data transfer process. The server has two components:
the server control process and the server data transfer process. The control connection is made
between the control processes. The data connection is made between the
data transfer processes.Separation of commands and data transfer makes FTP more efficient. The
control connection uses very simple rules of communication. We need to transfer only a line of
command or a line of response at a time. The data connection, on the other hand, needs more
complex rules due to the variety of data types transferred.
Two Connections
26.2.2 Control Connection
For control communication, FTP uses the same approach as TELNET (discussed later).
It uses the NVT ASCII character set as used by TELNET. Communication is achieved
through commands and responses. This simple method is adequate for the control con-
nection because we send one command (or response) at a time. Each line is terminated
with a two-character (carriage return and line feed) end-of-line token.
During this control connection, commands are sent from the client to the server and
responses are sent from the server to the client. Commands, which are sent from the FTP
client control process, are in the form of ASCII uppercase, which may or may not be followed by an
argument.
26.2.3 Data Connection
The data connection uses the well-known port 20 at the server site. However, the creation of a data
connection is different from the control connection. The following
shows the steps:
1. The client, not the server, issues a passive open using an ephemeral port. This must be
done by the client because it is the client that issues the commands for transferring files.
2. Using the PORT command the client sends this port number to the server.
3. The server receives the port number and issues an active open using the well-
known port
20 and the received ephemeral port number.

Every FTP command generates at least one response. A response has two parts: a
three-digit number followed by text. The numeric part defines the code; the text part
defines needed parameters or further explanations. The first digit defines the status of
the command. The second digit defines the area in which the status applies. The third
digit provides additional information. Table 26.5 shows some common responses.

---------------------------------------------------------------------------------------------------------------------------
With a flow diagram Explain how a file will be transfered between
client and server
The purpose and implementation of the data connection are different from those of the con-
trol connection. We want to transfer files through the data connection. The client must
define the type of file to be transferred, the structure of the data, and the transmission mode.
Before sending the file through the data connection, we prepare for transmission through
the control connection. The heterogeneity problem is resolved by defining three attributes
of communication: file type, data structure, and transmission mode.
File Type
FTP can transfer one of the following file types across the data connection: ASCII file,
EBCDIC file, or image file.
Data Structure
FTP can transfer a file across the data connection using one of the following interpreta-
tions of the structure of the data: file structure, record structure, or page structure. The
file structure format (used by default) has no structure. It is a continuous stream of
bytes. In the record structure, the file is divided into records. This can be used only with
text files. In the page structure, the file is divided into pages, with each page having a
page number and a page header. The pages can be stored and accessed randomly or
sequentially.
Transmission Mode
FTP can transfer a file across the data connection using one of the following three
transmission modes: stream mode, block mode, or compressed mode. The stream mode
is the default mode; data are delivered from FTP to TCP as a continuous stream of
bytes. In the block mode, data can be delivered from FTP to TCP in blocks. In this case,
each block is preceded by a 3-byte header. The first byte is called the block descriptor;
the next two bytes define the size of the block in bytes.
File Transfer
File transfer occurs over the data connection under the control of the commands sent
over the control connection. However, we should remember that file transfer in FTP
means one of three things: retrieving a file (server to client), storing a file (client to
server), and directory listing (server to client).
Example 26.10
Figure 26.11 shows an example of using FTP for retrieving a file. The figure shows only one file
to be transferred. The control connection remains open all the time, but the data connection is

opened and closed repeatedly. We assume the file is transferred in six sections. After all records
have been transferred, the server control process announces that the file transfer is done. Since
the client control process has no file to retrieve, it issues the QUIT command, which causes the
service connection to be closed.
Example 26.11
The following shows an actual FTP session that lists the directories. The colored lines show the
responses from the server control connection; the black lines show the commands sent by the cli-
ent. The lines in white with black background show data transfer.
---------------------------------------------------------------------------------------------------------------------------
Domain Name System (DNS)

Overview
The Domain Name System (DNS) is a critical component of the Internet infrastructure, designed to
translate human-readable domain names into numerical IP addresses. This system allows users to
access websites and services without memorizing complex numerical addresses. By providing a
hierarchical structure for domain names, DNS ensures efficient and user-friendly navigation across
the Internet.

Figure 26.29 Domain name space

Root

Top-level nodes

Figure 1: Overview of the Domain Name System structure.

Hierarchical Domain Name Structure


DNS operates as a hierarchical naming system, which can be visualized as a tree structure. At the top
of this hierarchy is the Root Domain, represented by a dot (.). Below the root are Top-Level
Domains (TLDs), such as .com, .org, and country-code domains like .uk and .us. Each TLD can have
multiple Second-Level Domains (e.g., example.com), which can be further divided into Subdomains
(e.g., www.example.com, mail.example.com).

Figure 2: Hierarchical structure of DNS domain names.

Components of DNS
Domain Names
Domain names are composed of labels separated by dots. Each label has a maximum length of 63
characters, allowing for a diverse range of names. For example, in www.example.com, www is a
subdomain, example is a second-level domain, and .com is the top-level domain.
DNS Servers
DNS employs different types of servers to resolve queries:
1. Authoritative DNS Servers: These servers hold DNS records for specific domains and
provide definitive answers to queries.
2. Recursive DNS Resolvers: Acting as intermediaries, these servers manage the querying
process on behalf of clients, seeking answers from authoritative servers.
3. Root DNS Servers: Positioned at the highest level of the DNS hierarchy, they direct queries
to the appropriate TLD servers.

Figure 3: Types of DNS servers and their roles in name resolution.

Resource Records (RRs)


Each DNS server stores a set of Resource Records (RRs), which provide the necessary information
for resolving domain names. The structure of a resource record typically includes:
 Domain Name: The name of the resource.
 Type: Indicates the nature of the record (e.g., A, AAAA, CNAME).
 Class: The class of the record (e.g., IN for Internet).
 TTL (Time to Live): The duration the record is valid in cache.
 Value: The associated data for the record.
Common types of resource records include:
 A Record: Maps a domain name to a 32-bit IPv4 address.
 AAAA Record: Maps a domain name to a 128-bit IPv6 address.
 CNAME Record: Defines an alias for the official name of a host.
 MX Record: Specifies the mail exchange server for a domain.
 NS Record: Identifies the authoritative servers for a zone.

Figure 26.33 Zone

Root

com Domain

mhhe Zone

Zone and
domain

Figure 4: Structure of DNS Resource Records.

DNS Resolution Process


Name-Address Resolution
The process of mapping a domain name to its corresponding IP address is known as name-address
resolution. This can occur through two primary methods: Recursive Resolution and Iterative
Resolution.

Recursive Resolution
In recursive resolution, a resolver queries multiple DNS servers until it finds the IP address. For
example, if a user wants to access engineering.mcgraw-hill.com, the resolver first queries the local
DNS server, which may then query the root server and TLD server until it finds the authoritative
server for the requested domain.
Figure 5: Flow of recursive resolution in DNS.

Iterative Resolution
In iterative resolution, the resolver queries one server at a time, which returns the next server's address
if it does not have the answer. This method typically occurs between local servers, with the original
resolver obtaining the final answer from a local DNS server.

Figure 6: Flow of iterative resolution in DNS.

Caching
To enhance efficiency, DNS employs caching to temporarily store DNS query results. When a DNS
server receives a query and resolves it, it caches the response for future requests. Each cached record
has a TTL (Time to Live) that defines how long it remains valid. If a cached record's TTL expires,
the server must re-query the authoritative DNS server for updated information.

Dynamic DNS (DDNS)


With the rapid growth of the Internet, the need for dynamically updating DNS records became
apparent. Dynamic Domain Name System (DDNS) allows for automatic updates to DNS records
when changes occur, such as adding or removing hosts.
In DDNS, when a binding between a name and an address is determined, this information is sent to
the primary DNS server, which updates the zone. Secondary servers can be notified actively (via
messages from the primary server) or passively (by periodic checks for updates).

Security Considerations
Despite its critical role, DNS is vulnerable to various attacks, including:
1. DNS Spoofing: Attackers intercept and alter DNS responses.
2. Denial-of-Service (DoS) Attacks: Flood DNS servers with requests to render them
unavailable.
To mitigate these risks, the DNS Security Extensions (DNSSEC) provide message origin
authentication and integrity through digital signatures. However, DNSSEC does not encrypt DNS
messages or offer specific protections against DoS attacks.
Brief note on cookies
The World Wide Web was originally designed as a stateless entity. A client sends a request; a server
responds. Their relationship is over.

Today the Web has other functions that need to remember some information about the clients;
some are listed below

Some websites need to allow access to registered clients only.

❑ Some websites are used as portals: the user selects the web pages he wants to see.
❑ Some websites are just advertising agencies.
For these purposes, the cookie mechanism was devised.

Creating and Storing Cookies


The creation and storing of cookies depend on the implementation; however, the princi ple is the
same. 1. When a server receives a request from a client, it stores information about the client in a file
or a string. The information may include the domain name of the client, the contents of the cookie
(information the server has gathered about the client such as name, registration number, and so on),

The server includes the cookie in the response that it sends to the client.

3. When the client receives the response, the browser stores the cookie in the cookie directory,
which is sorted by the server domain name.

When a client sends a request to a server, the browser looks in the cookie directory to see if it can
find a cookie sent by that server. If found, the cookie is included in the request. When the server
receives the request, it knows that this is an old client, not a new one.

An electronic store (e-commerce) can use a cookie for its client shoppers

The site that restricts access to registered clients only sends a cookie to the client when the client
registers for the first time.

A web portal uses the cookie in a similar way. When a user selects her favorite pages, a

cookie is made and sent

A cookie is also used by advertising agencies.


2. FILE TRANSFER WITH DIAGRAM

The purpose and implementation of the data connection are different from those of the control
connection.

We want to transfer files through the data connection.

The client must define the type of file to be transferred, the structure of the data, and the
transmission mode

File Type FTP can transfer one of the following file types across the data connection: ASCII file,
EBCDIC file, or image file.

Data Structure

FTP can transfer a file across the data connection using one of the following interpretations of the
structure of the data: file structure, record structure, or page structure.

The file structure format (used by default) has no structure. It is a continuous stream of bytes.

In the record structure, the file is divided into records. This can be used only with text files.

In the page structure, the file is divided into pages, with each page having a page number and a page
header. The pages can be stored and accessed randomly or sequentially.

Transmission Mode
FTP can transfer a file across the data connection using one of the following three transmission
modes: stream mode, block mode, or compressed mode.

The stream mode is the default mode; data are delivered from FTP to TCP as a continuous stream of
bytes.

In the block mode, data can be delivered from FTP to TCP in blocks. In this case, each block is
preceded by a 3-byte header
File Transfer
File transfer occurs over the data connection under the control of the commands sent over the
control connection. However, we should remember that file transfer in FTP means one of three
things: retrieving a file (server to client), storing a file (client to server), and directory listing (server to
client)

The following shows an actual FTP session that lists the directories.

You might also like