Unit 5
Unit 5
3
Cont..
6
Server
8
Cont..
The protocol is the client-server program used to
retrieve the document. Different protocols can retrieve a
document; among them are FTP, HTTP, & TELNET.
Static Documents
12
Dynamic Documents
The only thing that CGI defines is a set of rules & terms
that the programmer must follow.
TCP/IP Protocol Suite 14
Figure 8 Dynamic document using CGI
HTTP Transaction
Persistent versus Nonpersistent Connection
Proxy Server
$ telnet www.mhhe.com 80
Trying 198.45.24.104...
Connected to www.mhhe.com (198.45.24.104).
Escape character is '^]'.
GET /engcs/compsci/forouzan HTTP/1.1
From: [email protected]
HTTP/1.1 200 OK
Date: Thu, 28 Oct 2004 16:27:46 GMT
Server: Apache/1.3.9 (Unix) ApacheJServ/1.1.2 PHP/4.1.2 PHP/3.0.18
MIME-version:1.0
Content-Type: text/html
Last-modified: Friday, 15-Oct-04 02:11:31 GMT
Content-length: 14230
Connection closed by foreign host.
TCP/IP Protocol Suite 39
Note:
Objectives
Upon completion you will be able to:
The domain name space is hierarchical in design. The names are defined
in an inverted-tree structure with the root at the top. The tree can have
128 levels: level 0 (root) to level 127.
Label :- Each node in the tree has a label, which is a string with
a maximum of 63 characters. The root label is a null string.
Root label
Labels
It contains all labels, from the specific to the most general, that uniquely
define the name of the host.
A PQDN starts from a node, but it does not reach the root.
It is very insufficient & also not reliable to have just one computer store
such a huge amount of information.
One way to do this is to divide whole space into many domains based
on the first level.
In other words, let the root stand alone & create as many domains
(sub- trees) as there are first-level nodes as shown in diagram.
A root server usually does not store any information about domains
but delegates its authority to other servers, keeping references to
those servers.
The server makes a database called a zone file & keeps all the
information for every node under that domain.
The secondary server neither creates nor updates the zone files.
A primary server loads all information from the disk file; the
secondary server loads all information from the primary
server. When the secondary downloads information from the
primary, it is called zone transfer.
In the Internet, the domain name space (tree) is divided into three
different sections: generic domains, country domains, and the inverse
domain.
The second level is also one single node named in-addr The rest
domain defines IP addresses.
Both query & response have same header format with some
fields set to zero for query messages. The header is 12 byte(96-
bit) & its format is shown bellow.
16-bit 16-bit
16-bit 16-bit
16-bit 16-bit
As we have seen in the previous section, two types of records are used in
DNS.
The question records are used in the question section of the query and
response messages.
Table 3 Types
Table 4 Classes
Domain Type:- This field is the same as the query type field in the
question record except the last two types are not allowed.
Domain class:- This field is the same as the query class field in the
question record.
The QR bit defines the message as a query. The OpCode is 0000, which
defines a standard query. The recursion desired (RD) bit is set. (Refer back
to Figure 17.16 for the flags field descriptions.) The message contains only
one question record. The domain name is 4chal4fhda3edu0. The next 2
bytes define the query type as an IP address; the last 2 bytes define the class
as the Internet.
Figure 17.22 shows the response of the server. The response is similar to the
query except that the flags are different and the number of answer records
is one. The flags value is 0x8180 in hexadecimal. In binary it is
1000000110000000, but again we divide it into fields as shown below:
The QR bit defines the message as a response. The OpCode is 0000, which
defines a standard response. The recursion available (RA) and RD bits are
set. The message contains one question record and one answer record. The
question record is repeated from the query message. The answer record has
a value of 0xC00C (split in two lines), which points to the question record
instead of repeating the domain name. The next field defines the domain
type (address). The field after that defines the class (Internet). The field with
the value 12,000 is the TTL (12,000 s). The next field is the length of the
resource data, which is an IP address (153.18.8.105).
Figure 17.23 shows the query message sent from the resolver to the server.
The first 2 bytes show the identifier (0x1200). The flags value is 0x0900 in
hexadecimal. In binary it is 0000100100000000, and we divide it into fields
as shown below:
The OpCode is 0001, which defines an inverse query. The message contains
only one question record. The domain name is 19171231537in-addr4arpa.
The next 2 bytes define the query type as PTR, and the last 2 bytes define
the class as the Internet.
$ nslookup fhda.edu
Name: fhda.edu
Address: 153.18.8.1
The Dynamic Domain Name System (DDNS) updates the DNS master
file dynamically.
DNS uses UDP as the transport protocol when the size of the response
message is less than 512 bytes. If the size of the response message is
more than 512 bytes, a TCP connection is used.
In both the cases well-known port used by the server is port 53.
96
Introduction
97
1 ARCHITECTURE
First Scenario:
In the first scenario, the sender & the receiver of the email are users(or
application programs) on the same system; they are directly connected
to a shared system.
A administrator has created one mailbox for each user where the
received messages are stored.
Bob can retrieve & read the contents of his mailbox at his convenience
using a user agent.
98
Figure 1 First scenario
99
Note:
100
Figure 2 Second Scenario
In the second scenario, the sender & the receiver of the email are
users(or application program) on two different systems.
101
Cont..
The server needs to run all the time because it does not
know when a client will ask for connection.
102
Note:
103
Third scenario
In the third scenario, Alice is either connected to the system via a
point-to-point WAN- such as a dial-up modem, or a cable modem –
or he is connected to a LAN in an organization that uses one mail
server for handling emails;
Alice still needs a user agent to prepare his message. He then needs
to send the message through the LAN or WAN.
The MTA client establishes a connection with the MTA server on the
system, which is running all the time.
104
Figure 3 Third scenario
105
Note:
106
Fourth Scenario
108
Fi Figure 5 Push vs. pull
Note that Bob needs another pair of client-server programs; message access
programs. This is because an MTA client-server program is push program; the
client pushes the message to the server. Bob needs a pull program. The client
needs to pull the message from the server .
109
Note:
110
Each 6-bit section is interpreted as one character according table 3
The formal protocol that defines the MTA client & server in
the Internet is called Simple Mail Transfer Protocol (SMTP).
SMTP is used two times, between the sender & sender’s mail server
& between the two mail servers.
SMTP simply defines how commands & responses must be sent back &
forth.
116
Responses: Responses are sent from the server to the client.
124
Figure 18 Connection termination
125
Example 1
Let us see how we can directly use SMTP to send an email and simulate the
commands and responses we described in this section. We use TELNET to
log into port 25 (the well-known port for SMTP). We then use the
commands directly to send an email. In this example,
[email protected] is sending an email to himself. The first few lines
show TELNET trying to connect to the adelphia mail server.
$ telnet mail.adelphia.net 25
Trying 68.168.78.100...
Connected to mail.adelphia.net (68.168.78.100).
After connection, we can type the SMTP commands and then receive the
responses as shown below. We have shown the commands in black and the
responses in color. Note that we have added for clarification some comment
lines, designated by the “=” sign. These lines are not part of the email
procedure.
126
Example 1 (Continued)
128
4 MESSAGE ACCESS AGENT: POP AND IMAP
The third stage needs a pull protocol; the client must pull
messages from server. The third stage uses a message access
agent.
129
Figure 19 POP3 and IMAP4
TCP/IP Protocol Suite 133
File Transfer Protocol:
FTP
Objectives
Upon completion you will be able to:
Control Connections:-
First Digit:- The first digit defines the status of the command(1-5).
Second Digit:- The second digit also defines the status of the command(0-5).
10. The server then sends the list of the files or directories (as a
file) on the data connection. When the whole list (file) is
sent, the server responds with 226 (closing data connection)
over the control connection.
11. The client now has two choices. It can use the QUIT
command to request the closing of the
control connection or it can send another command to
start another activity (and eventually open another data
connection). In our example, the client sends a QUIT
command.
12. After receiving the QUIT command, the server responds
with 221 (service closing) and then closes the control
connection.
See Next Slide
TCP/IP Protocol Suite 159
Figure 8 Example 1
Note:
Objectives
Upon completion you will be able to:
TELNET is a general-purpose
client-server application program.
• The user can run a program, access the system resources, switch
from one program to another & so on.
Login:- To access the system, the user logs into the system with
user id or login name. The system also includes password checking to
prevent an unauthorized user from accessing the resources.
The terminal driver passes the characters to the O.S. The O.S.,
in turn, interprets the combination of characters & invokes the
desired application program or utility.
The user sends the keystrokes to the terminal driver where the
local operating system accepts the characters but does not
interpret them.
NVT