0% found this document useful (0 votes)
7 views45 pages

CN V Unit Notes

The document discusses the Transport Layer and its protocols, specifically the User Datagram Protocol (UDP) and Transmission Control Protocol (TCP), detailing their features, functions, and applications. UDP is characterized as a simple, unreliable protocol suitable for one-way data flows, while TCP is a reliable, connection-oriented protocol that ensures ordered delivery and error recovery. Additionally, the document covers the Application Layer, including the Domain Name System (DNS) and its role in mapping domain names to IP addresses.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views45 pages

CN V Unit Notes

The document discusses the Transport Layer and its protocols, specifically the User Datagram Protocol (UDP) and Transmission Control Protocol (TCP), detailing their features, functions, and applications. UDP is characterized as a simple, unreliable protocol suitable for one-way data flows, while TCP is a reliable, connection-oriented protocol that ensures ordered delivery and error recovery. Additionally, the document covers the Application Layer, including the Domain Name System (DNS) and its role in mapping domain names to IP addresses.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

Unit –V

Transport Layer: Process to Process Delivery – User Datagram Protocol - TCP.


Application Layer: Domain Name Space – DNS in the Internet – Electronic Mail
– File Transfer. WWW: Architecture – HTTP.

Transport Layer :

1) Decides if data transmission should be on parallel path or single path.


2) Functions such as Multiplexing, Segmenting or Splitting on the data are done by
this layer
3) It receives messages from the Session layer above it, convert the message into
smaller units and passes it on to the Network layer.
4) Transport layer can be very complex, depending upon the network requirements.
5) Transport layer breaks the message (data) into small units so that they are handled
more efficiently by the network layer.

Transport Layer Protocols:

The two main Transport layer protocols are:

 Transmission Control Protocol

It provides reliable communication between two hosts.

 User Datagram Protocol

It provides unreliable communication between two hosts.


User Datagram Protocol

 The User Datagram Protocol (UDP) is simplest Transport Layer communication


protocol available of the TCP/IP protocol suite.

 It involves minimum amount of communication mechanism. UDP is said to be an


unreliable transport protocol but it uses IP services which provides best effort
delivery mechanism.
 In UDP, the receiver does not generate an acknowledgement of packet received and
in turn, the sender does not wait for any acknowledgement of packet sent.

 This shortcoming makes this protocol unreliable as well as easier on processing.

FEATURES

 UDP is used when acknowledgement of data does not hold any significance.

 UDP is good protocol for data flowing in one direction.

 UDP is simple and suitable for query based communications.

 UDP is not connection oriented.

 UDP does not provide congestion control mechanism.

 UDP does not guarantee ordered delivery of data.

 UDP is stateless.

 UDP is suitable protocol for streaming applications such as VoIP, multimedia


streaming.

UDPHeader

 UDP header is as simple as its function.

UDP header contains four main parameters:

 Source Port - This 16 bits information is used to identify the source port of the
packet.

 Destination Port - This 16 bits information, is used identify application level


service on destination machine.

 Length - Length field specifies the entire length of UDP packet (including header).
It is 16-bits field and minimum value is 8-byte, i.e. the size of UDP header itself.
 Checksum - This field stores the checksum value generated by the sender before
sending. IPv4 has this field as optional so when checksum field does not contain
any value it is made 0 and all its bits are set to zero.

UDPapplication

Here are few applications where UDP is used to transmit data:

 Domain Name Services

 Simple Network Management Protocol

 Trivial File Transfer Protocol

 Routing Information Protocol

 Kerberos
TRANSMISSION CONTROL PROTOCOL (TCP):

 Transmission Control Protocol (TCP) is one of the most important protocols of


Internet Protocols suite. It is most widely used protocol for data transmission in
communication network such as internet.

Features

 TCP is reliable protocol. That is, the receiver always sends either positive or
negative acknowledgement about the data packet to the sender, so that the sender
always has bright clue about whether the data packet is reached the destination or it
needs to resend it.

 TCP ensures that the data reaches intended destination in the same order it was sent.

 TCP is connection oriented. TCP requires that connection between two remote
points be established before sending actual data.

 TCP provides error-checking and recovery mechanism.

 TCP provides end-to-end communication.

 TCP provides flow control and quality of service.

 TCP operates in Client/Server point-to-point mode.

 TCP provides full duplex server, i.e. it can perform roles of both receiver and
sender.

Header

 The length of TCP header is minimum 20 bytes long and maximum 60 bytes
Source Port (16-bits) - It identifies source port of the application process on the sending device.

Destination Port (16-bits) - It identifies destination port of the application process on the
receiving device.

Sequence Number (32-bits) - Sequence number of data bytes of a segment in a session.

 Acknowledgement Number (32-bits) - When ACK flag is set, this number contains
the next sequence number of the data byte expected and works as acknowledgement
of the previous data received.

Data Offset (4-bits) - This field implies both, the size of TCP header (32-bit words) and the
offset of data in current packet in the whole TCP segment.

Reserved (3-bits) - Reserved for future use and all are set zero by default.

Flags (1-bit each)

o NS - Nonce Sum bit is used by Explicit Congestion Notification signaling


process.

o CWR - When a host receives packet with ECE bit set, it sets Congestion
Windows Reduced to acknowledge that ECE received.

o ECE -It has two meanings:

 If SYN bit is clear to 0, then ECE means that the IP packet has its CE
(congestion experience) bit set.

 If SYN bit is set to 1, ECE means that the device is ECT capable.

o URG - It indicates that Urgent Pointer field has significant data and should be
processed.

o ACK - It indicates that Acknowledgement field has significance. If ACK is


cleared to 0, it indicates that packet does not contain any acknowledgement.

o PSH - When set, it is a request to the receiving station to PUSH data (as soon
as it comes) to the receiving application without buffering it.
o RST - Reset flag has the following features:

 It is used to refuse an incoming connection.

 It is used to reject a segment.

 It is used to restart a connection.

o SYN - This flag is used to set up a connection between hosts.

o FIN - This flag is used to release a connection and no more data is exchanged
thereafter. Because packets with SYN and FIN flags have sequence numbers,
they are processed in correct order

Flow control

 Flow control is a function for the control of the data flow within an OSI layer or
between adjacent layers. In other words it limits the amount of data transmitted by
the sending transport entity to a level, or rate, that the receiver can manage.

 At the transport level flow control will allow the transport protocol entity in a host
to restrict the flow of data over a logical connection from the transport protocol
entity in another host. However, one of the services of the network level is to prevent
congestion.

 The flow control mechanisms used in the transport layer vary for the different classes
of service. Since the different classes of service are determined by the quality of
service of the underlying data network which transports the transport protocol data
units (TPDUs), it is these which influence the type of flow control used.

Two reasons for this are:

 Flow control must interact with transport users, transport entities, and the network
service.
 Long and variable transmission delays between transport entities.
There are two reasons why the receiving transport entity would want to control the flow of
TPDUs:

 The receiving user cannot keep up with the flow of data


 The receiving transport entity itself cannot keep up with the flow of TPDUs

 When we say that a user or transport entity cannot keep up with the data flow, we
mean that the receiving buffers are filling too quickly and will overflow and lose
data unless the rate of incoming data is slowed.

Error control

TCP protocol has methods for finding out corrupted segments, missing segments, out-of-
order segments and duplicated segments.

Error control in TCP is mainly done through use of three simple techniques :

1. Checksum – Every segment contains a checksum field which is used to find corrupted
segment. If the segment is corrupted, then that segment is discarded by the destination
TCP and is considered as lost.
2. Acknowledgement – TCP has another mechanism called acknowledgement to affirm
that the data segments have been delivered. Control segments that contain no data but
have sequence number will be acknowledged as well but ACK segments are not
acknowledged.
3. Retransmission – When a segment is missing, delayed to deliver to receiver, corrupted
when it is checked by receiver then that segment is retransmitted again. Segments are
retransmitted only during two events: when the sender receives three duplicate
acknowledgements (ACK) or when a retransmission timer expires.
1. Retransmission after RTO : TCP always preserve one retransmission time-out
(RTO) timer for all sent but not acknowledged segments. When the timer runs out
of time, the earliest segment is retransmitted. Here no timer is set for
acknowledgement. In TCP, RTO value is dynamic in nature and it is updated
using round trip time (RTT) of segments. RTT is the time duration needed for a
2. Retransmission after Three duplicate ACK segments : RTO method works
well when the value of RTO is small. If it is large, more time is needed to get
confirmation about whether a segment has delivered or not. Sometimes one
segment is lost and the receiver receives so many out-of-order segments that they
cannot be saved. In order to solve this situation, three duplicate
acknowledgement method is used and missing segment is retransmitted
immediately instead of retransmitting already delivered segment. This is a fast
retransmission because it makes it possible to quickly retransmit lost segments
instead of waiting for timer to end.

TCP Congestion Control:


 Congestion control refers to the techniques used to control or prevent congestion.
Congestion control techniques can be broadly classified into two categories:

Open Loop Congestion Control


 Open loop congestion control policies are applied to prevent congestion before it
happens. The congestion control is handled either by the source or the destination.
1. Retransmission Policy :

It is the policy in which retransmission of the packets are taken care. If the sender
feels that a sent packet is lost or corrupted, the packet needs to be retransmitted.

This transmission may increase the congestion in the network.


To prevent congestion, retransmission timers must be designed to prevent congestion
and also able to optimize efficiency.

2. Window Policy :

The type of window at the sender side may also affect the congestion. Several
packets in the Go-back-n window are resent, although some packets may be
received successfully at the receiver side. This duplication may increase the
congestion in the network and making it worse.

Therefore, Selective repeat window should be adopted as it sends the specific packet
that may have been lost.

3. Discarding Policy :

A good discarding policy adopted by the routers is that the routers may prevent
congestion and at the same time partially discards the corrupted or less sensitive
package and also able to maintain the quality of a message.
In case of audio file transmission, routers can discard less sensitive packets to prevent
congestion and also maintain the quality of the audio file.
4. Acknowledgment Policy :

Since acknowledgement are also the part of the load in network, the
acknowledgment policy imposed by the receiver may also affect congestion. Several
approaches can be used to prevent congestion related to acknowledgment.

The receiver should send acknowledgement for N packets rather than sending
acknowledgement for a single packet. The receiver should send a acknowledgment only
if it has to sent a packet or a timer expires.

5. Admission Policy :

In admission policy a mechanism should be used to prevent congestion. Switches in a


flow should first check the resource requirement of a network flow before
transmitting it further. If there is a chance of a congestion or there is a congestion in
the network, router should deny establishing a virtual network connection to prevent
further congestion.

Closed Loop Congestion Control


Closed loop congestion control technique is used to treat or alleviate congestion after it
happens. Several techniques are used by different protocols; some of them are:

1. Backpressure :
Backpressure is a technique in which a congested node stop receiving packet from
upstream node. This may cause the upstream node or nodes to become congested
and rejects receiving data from above nodes. Backpressure is a node-to-node
congestion control technique that propagate in the opposite direction of data flow.
The backpressure technique can be applied only to virtual circuit where each node
has information of its above upstream node.
1. Implicit Signaling :

In implicit signaling, there is no communication between the congested nodes and the
source. The source guesses that there is congestion in a network. For example when
sender sends several packets and there is no acknowledgment for a while, one
assumption is that there is a congestion.

2. Explicit Signaling :

In explicit signaling, if a node experiences congestion it can explicitly sends a packet to


the source or destination to inform about congestion. The difference between choke
packet and explicit signaling is that the signal is included in the packets that carry
data rather than creating different packet as in case of choke packet technique.
Explicit signaling can occur in either forward or backward direction.

Timer Management

TCP uses different types of timer to control and management various tasks:

Keep-alive timer:
 This timer is used to check the integrity and validity of a connection.

 When keep-alive time expires, the host sends a probe to check if the connection still
exists.

Retransmission timer:
 This timer maintains stateful session of data sent.

 If the acknowledgement of sent data does not receive within the Retransmission
time, the data segment is sent again.

Persist timer:
 TCP session can be paused by either host by sending Window Size 0.

 To resume the session a host needs to send Window Size with some larger value.
 If this segment never reaches the other end, both ends may wait for each other for
infinite time.

 When the Persist timer expires, the host re-sends its window size to let the other end
know.

 Persist Timer helps avoid deadlocks in communication.

Timed-Wait:
 After releasing a connection, either of the hosts waits for a Timed-Wait time to
terminate the connection completely. 

 This is in order to make sure that the other end has received the acknowledgement
of its connection termination request.

 Timed-out can be a maximum of 240 seconds (4 minutes).


Crash Recovery

 TCP is very reliable protocol. It provides sequence number to each of byte sent in
segment. It provides the feedback mechanism i.e. when a host receives a packet, it is
bound to ACK that packet having the next sequence number expected (if it is not the
last segment).
When a TCP Server crashes mid-way communication and re-starts its process it sends TPDU broadcast
to all its hosts. The hosts can then send the last data segment which was never unacknowledged and
carry onwards.

Application Layer is the topmost layer.

1) Transferring of files disturbing the results to the user is also done in this layer . Mail
services, directory services, network resource etc are services provided by application
layer.
2) This layer mainly holds application programs to act upon the received and to be sent data.
3) There’is an ambiguity in understanding Application Layer and its protocol. Not
every user application can be put into Application Layer. except those applications
which interact with the communication system.
4) For example, designing software or text-editor cannot be considered as application
layer programs.
5) On the other hand, when we use a Web Browser, which is actually using Hyper Text
Transfer Protocol (HTTP) to interact with the network. HTTP is Application Layer
protocol
DOMAIN NAME SYSTEM (DNS)
1. The Domain Name System (DNS) is a supporting program that is used by other programs
such as e-mail.

2. A user of an e-mail program may know the e-mail address of the recipient; however, the IP
protocol needs the IP address.

3. The DNS client program sends a request to a DNS server to map the e-mail address to the
corresponding IP address.

4. When the Internet was small, mapping was done by using a host file. The host file had only
two columns: name and address.

5. Every host could store the host file on its disk and update it periodically from a master host
file. When a program or a user wanted to map a name to an address, the host consulted the
host file and found the mapping.

6. Today, however, it is impossible to have one single host file to relate every address with a
name and vice versa. The host file would be too large to store in every host.

7. One solution is to divide this huge amount of information into smaller parts and store each
part on a different computer.

8. In this method, the host that needs mapping can contact the closest computer holding the
needed information. This method is used by the Domain Name System (DNS).

Name Space

1. The names must be unique because the addresses are unique. A name space that maps each
address to a unique name can be organized in two ways:

a. Flat Name Space-A name is assigned to an address. A name in this space is a


sequence of characters without structure. It cannot be used in a large system such
as the Internet.

b. Hierarchical Name Space-Each name is made of several parts. The first part can
define the nature of the organization, the second part can define the name of an
organization, and the third part can define departments in the organization, and
so on.
Domain Name Space

To have a hierarchical name space, a domain name space was designed. In this design the
names are defined in an inverted-tree structure with the root at the top. The tree can have only
128 levels: level 0 (root) to level 127 (see Fig.5.19).

Fig.5.19 Domain Name Space

Label

1. 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 (empty string).

2. DNS requires that children of a node (nodes that branch from the same node) have
different labels, which guarantees the uniqueness of the domain names.

Domain Name

1. Each node in the tree has a domain name as in fig.5.20. A full domain name is a sequence
of labels separated by dots (.).

2. The domain names are always read from the node up to the root.

3. The last label is the label of the root (null). This means that a full domain name always
ends in a null label, which means the last character is a dot because the null string is
nothing.
Fig.5.20 Domain names and labels

Domain

1. A domain is a subtree of the domain name space.

2. The name of the domain is the domain name of the node at the top of the sub tree. Fig.5.21
shows some domains. Note that a domain may itself be divided into domains (or sub
domains as they are sometimes called).

Fig.5.21 Domains
Distribution of Name Space

1. The information contained in the domain name space must be stored. However, it is very
inefficient because responding to requests from all over the world places a heavy load on
the system.

2. The solution to these problems is to distribute the information among many computers
called DNS servers.

3. One way to do this is to divide the whole space into many domains based on the first level.

Zone

1. Since the complete domain name hierarchy cannot be stored on a single server, it is
divided among many servers.

2. What a server is responsible for or has authority over is called a zone. We can define a zone
as a contiguous part of the entire tree.

3. A primary server loads all information from the disk file; the secondary server loads all
information from the primary server.

4. When the secondary downloads information from the primary, it is called zone transfer.

DNS in the Internet

DNS is a protocol that can be used in different platforms. In the Internet, the domain
name space (tree) is divided into three different sections: generic domains, country domains, and
the inverse domain.
1. Generic Domains

– The generic domains define registered hosts according to their generic behavior as in fig.5.22.

– Each node in the tree defines a domain, which is an index to the domain name space database.

Fig.5.22 Generic domains

2. Country Domains

– The country domains section uses two-character country abbreviations (e.g., us for United
States).

– Second labels can be organizational, or they can be more specific, national designations.

– The United States, for example, uses state abbreviations as a subdivision of us (e.g.,
ca.us.).Fig.5.23 shows the country domains section.

– The address anza.cup.ca.us can be translated to De Anza College in Cupertino, California, in


the United States.
Fig.5.23 Country Domain

3. Inverse Domain

– The inverse domain is used to map an address to a name. This may happen, for example,
when a server has received a request from a client to do a task.

– Although the server has a file that contains a list of authorized clients, only the IP address of
the client is listed.

– The server asks its resolver to send a query to the DNS server to map an address to a name
to determine if the client is on the authorized list.

Fig.5.24 Inverse Domain


 This type of query is called an inverse or pointer (PTR) query. To handle a pointer query,
the inverse domain is added to the domain name space with the first-level node called arpa
(for historical reasons) as shown in fig.5.24.
 The second level is also one single node named in-addr (for inverse address). The rest of
the domain defines IP addresses
 The servers that handle the inverse domain are also hierarchical. This means the netid
part of the address should be at a higher level than the subnetid part, and the subnetid
part
Client Server Programming:

Two remote application processes can communicate mainly in two different fashions:

 Peer-to-peer: Both remote processes are executing at same level and they exchange
data using some shared resource.

 Client-Server: One remote process acts as a Client and requests some resource
from another application process acting as Server.

In client-server model, any process can act as Server or Client. It is not the type of machine,
size of the machine, or its computing power which makes it server; it is the ability of
serving request that makes a machine a server
A system can act as Server and Client simultaneously. That is, one process is acting as
Server and another is acting as a client. This may also happen that both client and server
processes reside on the same machine.

Communication

Two processes in client-server model can interact in various ways:

 Sockets

 Remote Procedure Calls (RPC)

Sockets

 In this paradigm, the process acting as Server opens a socket using a well-known (or
known by client) port and waits until some client request comes.

 The second process acting as a Client also opens a socket but instead of waiting for
an incoming request, the client processes ‘requests first’.
 When the request is reached to server, it is served. It can either be an
information sharing or resource request.

REMOTE PROCEDURE CALL


 This is a mechanism where one process interacts with another by means of
procedure calls. One process (client) calls the procedure lying on remote
host.

 The process on remote host is said to be Server. Both processes are


allocated stubs. This communication happens in the following way:

 The client process calls the client stub. It passes all the parameters pertaining to
program local to it.

 All parameters are then packed (marshalled) and a system call is made to send them
to other side of the network.
 Kernel sends the data over the network and the other end receives it.

 The remote host passes data to the server stub where it is unmarshalled.

 The parameters are passed to the procedure and the procedure is then executed.

 The result is sent back to the client in the same manner.

World Wide Web (WWW) :

1. The World Wide Web (WWW) is a repository of information linked together from
points all over the world.

2. The WWW has a unique combination of flexibility, portability, and user-friendly


features that distinguish it from other services provided by the Internet.

3. The WWW project was initiated by CERN (European Laboratory for Particle
Physics) to create a system to handle distributed resources necessary for scientific
research.

Architecture

1. The WWW today is a distributed client/server service, in which a client using a


browser can access a service using a server. However, the service provided is
distributed over many locations called sites.

2. Each site holds one or more documents, referred to as Web pages. Each Web page
can contain a link to other pages in the same site or at other sites.

3. The pages can be retrieved and viewed by using browsers shown in Fig. The client
needs to see some information that it knows belongs to site A.
4. It sends a request through its browser, a program that is designed to fetch Web
documents.

5. The request, among other information, includes the address of the site and the
Web page, called the URL.

Fig. Architecture of WWW

4. The server at site A finds the document and sends it to the client. When the user
views the document, she finds some references to other documents, including a Web
page at site B.

5. The reference has the URL for the new site. The user is also interested in seeing
this document. The client sends another request to the new site, and the new page
is retrieved.
Client (Browser):

1) Each browser usually consists of three parts: a controller, client protocol,


and interpreters.

2) The controller receives input from the keyboard or the mouse and uses the
client programs to access the document as in fig.

Fig. Browser Architecture

 After document has been accessed, the controller uses one of the interpreters
to display the document on the screen.

 The client protocol can be one of the protocols described previously such as FTP or HTTP.

 The interpreter can be HTML, Java, or JavaScript, depending on the type of document.

Uniform Resource Locator (URL):

 A client that wants to access a Web page needs the address. To facilitate
the access of documents distributed throughout the world, HTTP uses
locators.

 The uniform resource locator (URL) is a standard for specifying any


kind of information on the Internet. The URL defines four things:
protocol, host computer, port, and path as in Fig.
Fig. URL
 The protocol is the client/server program used to retrieve the document.

 The host is the computer on which the information is located, although


the name of the computer can be an alias.

 The URL can optionally contain the port number of the server. If the
port is included, it is inserted between the host and the path, and it is
separated from the host by a colon.

 Path is the pathname of the file where the information is located.

Cookie:
 Cookies are small files which are stored on a user's computer. They are
designed to hold a modest amount of data specific to a particular client
and website, and can be accessed either by the web server or the client
computer.

Web Documents:
The documents in the WWW can be grouped into three broad categories: static, dynamic,
and active.

Static Documents

 Static documents are fixed-content documents that are created and


stored in a server as shown in fig. The client can get only a copy of the
document. Of course, the contents in the server can be changed, but the user
cannot change them.
Fig. Static Document
Hypertext Markup Language (HTML)

 Hypertext Markup Language (HTML) is a language for creating Web pages.

 For an example, to make part of a text displayed in boldface with HTML,


we put beginning and ending boldface tags (marks) in the text, as shown
in Fig.5.12.

Fig. Boldface tags

 The two tags <B> and </B> are instructions for the browser. When the browser
sees these two marks, it knows that the text must be boldfaced.

 A markup language such as HTML allows us to embed formatting


instructions in the file itself. The instructions are included with the text.

 A Web page is made up of two parts: the head and the body. The head is the
first part of a Web page.

 The head contains the title of the page and other parameters that the
browser will use. The actual contents of a page are in the body, which includes
the text and the tags.

Dynamic Documents

– A dynamic document is created by a Web server whenever a browser requests the


document as in fig.

– When a request arrives, the Web server runs an application program or a script that
creates the dynamic document.
3. Active Documents

 For many applications, we need a program or a script to be run at the client site.
 These are called active documents.
 For example, suppose we want to run a program that creates animated graphics on
the screen or a program that interacts with the user.
 The program definitely needs to be run at the client site where the animation or
interaction takes place.
 When a browser requests an active document, the server sends a copy of the
document or a script. The document is then run at the client (browser) site.

Fig. Active document using Java applet

 One way to create an active document is to use Java applets. Java is a


combination of a high-level programming language, a run-time environment,
and a class library that allows a programmer to write an active document (an
applet) and a browser to run it.

Hypertext Transfer Protocol (HTTP)

1. The Hypertext Transfer Protocol (HTTP) is a protocol used mainly to access data
on the World Wide Web.

2. HTTP functions as a combination of FTP and SMTP.

3. It is similar to FTP because it transfers files and uses the services of TCP.
However, it is much simpler than FTP because it uses only one TCP connection.
4. HTTP is like SMTP because the data transferred between the client and the
server look like SMTP messages.

5. SMTP messages are stored and forwarded, but HTTP messages are delivered
immediately. HTTP uses the services of TCP on well-known port 80.

HTTP Transaction

1. Although HTTP uses the services of TCP, HTTP itself is a stateless protocol. The
client initializes the transaction by sending a request message.

2. The server replies by sending a response.Fig. illustrates the HTTP transaction


between the client and server.

Fig HTTP transaction

Messages:
1. The formats of the request and response messages are similar; both are shown in
Fig.below . A request message consists of a request line, a header, and sometimes a
body.
2. A response message consists of a status line, a header, and sometimes a body.

Fig Request and Response messages


Request and Status Lines: The first line in a request message is called a request line; the
first line in the response message is called the status line (see above 2 fig).

Request type (methods): This field is used in the request message. In version 1.1 of HTTP,
several request types are defined. GET, HEAD, POST, PUT, TRACE, CONNECT, OPTION are
methods.

URL:Uniform Resource Locator

Version: The most current version of HTTP is 1.1.

Status code: This field is used in the response message. The status code field is similar to
those in the FTP and the SMTP protocols. 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.

Status phrase: This field is used in the response message. It explains the status code in text
form.

Header: The header exchanges additional information between the client and the server.

Body: The body can be present in a request or response message. Usually, it contains the
document to be sent or received.
WEB SERVICES

 Web services used for building large number of application to application protocols.
Enabling direct application to application protocol comes from business world.

 For example: user can order a book from amazon.com. Once your book has been
shipped, amazon sends you tracking number in email. You can track the status of your
package from amazon.com website itself. Actually, Amazon & Fedex (transport
products) exchange information to track the packages.
Architecture

 It provides two architectures to simplify & automate the task of protocol design and
implementations.
Custom application protocols (WSDL, SOAP)
Generate protocols that are customized to each network applications.

a) Provides framework for protocol specification.

b) Supports software toolkits for automatically generating protocol implementations.

c) It supports procedural style approach

A generic application protocols (REST)

a)
Generic protocols use World Wide Web resources identified by URIs and access via
HTTP.

b) It supports data oriented or document passing style approach

c) Rest architecture's strength includes stability & scalability.


FTP (File Transfer Protocol)

File Transfer Protocol is a standard network protocol used to exchange and manipulate files
over a TCP/IP-based network, such as the Internet. FTP is built on client-server architecture
and utilizes separate control and data connections between the client and server applications.

One problem with downloading files over the Internet is that some files are so large that it
can take a tremendous amount of time to download them. As a way to speed up file transfers
and save space on the FTP server, files are commonly compressed.

Features of FTP

The basic features of FTP are:

1. Data representation

1) FTP handles three types of data representations-ASCII (7 bit), EBCDIC (8-bit) and 8-
binary data.

2) The ASCII file is the default format for transferring text files

3) Each character is encoded using 7-bit ASCII. The sender transforms the file from its
own representation into ASCII characters and the receiver transforms the ASCII
character to its own representation.

4) The image file is the default format for transferring binary files. The file is sent as
continuous streams of bits without any interpretation or encoding.

2. File organization and Data structures

1) FTP supports both unstructured and structured file.

2) An unstructured file contains string of bytes and is enl-marked by EOF (End of file).
The data structure that corresponds to such a file is called file structure.

3) A structured file contains a list of records and each record is delimited by EDR (End
of Record). The data structure of such file is called record structure i.e. file is
divided into records.
3. Transmission modes

• FTP can transfer a file by using one of the following three modes:

Stream mode

1) It is the default mode.

2) File is transmitted as continuous stream of bytes to TCP.

3) TCP is responsible for chopping data into segments of appropriate size.

4) If data is simply a stream of bytes (file structure), no end-of-file is needed. EOF in


this case is the closing of the data connection by the sender.

5) If data is divided into records (record structure), each record has a I-byte EOR (End-
of-Record) character and the end of the file has a I-byte EOF (End-of-file) character.

Block mode

1) Data is delivered from FTP to TCP in blocks.

2) Each block is preceded by 3 bytes header.

3) The first byte is called the block descriptor.

4) The second and third byte defines the size of the block in bytes.

Compressed mode

1) Data is usually compressed if the file to be transmitted is very big.

2) The compression method normally used in Run-length encoding.

3) In a text file, usually spaces (blanks) are removed.

4) In a binary file, null characters are compressed.

4. Error control

• Since TCP is used for data transfer no additional error recovery mechanism is required.

5. Access control

• File access protection is done using login procedure with login name and password.
FTP operation

1) FTP uses client/server model for communication.

2) Two TCP connections are used for file transfer.

3) On one connection control signals (commands and responses) are exchanged and the
other connection is used for actual data transfer. These two connections are called
control connection and data connection respectively.

Control Connection

The Control connection has following features:

1. It is used to transfer control signals (commands and responses) between the client and
server.

2. This connection is used by the control process of client and server. The control process is
called Protocol Interpreter (PI).

3. The TCP connection for control signal uses well-known FTP server port 21.

4. This control connection remains connected during the entire interactive FTP session.
5. 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.

6. The two control processes (client & server) or PI communicates using NVT syntax.

7. The PIs are responsible for translating the local code or syntax. (e.g. DOS or UNIX) into
NVT syntax and vice-versa.

Data Connection

The Data connection has following features:

1. Data connection is used for actual data transfer.

2. This connection is established between the Data Transfer Process (DTP) of client and
server

3. The server port used for data connection is Port 20.

4. The data connection is opened and then closed for each file transferred. It opens each time
commands that involve transferring files are used, and it closes when the file is transferred.

5. File transfer occurs over the data connection under the control of the commands sent over
the control connection.

6. During the file transfer, the client must define the type of file to be transferred, the
structure of data and the transmission mode.
ELECTRONIC MAIL

1. One of the most popular Internet services is electronic mail (e-mail).

2. It allows a message to include text, audio, and video. It also allows one message
to be sent to one or more recipients.

3. E-mail system includes three main components: user agent, message transfer
agent, and message access agent.

Architecture

1) The sender and the receiver of the e-mail are users (or application programs) on the
same system; they are directly connected to a shared system.

2) The administrator has created one mailbox for each user where the received messages
are stored. A mailbox is part of a local hard drive, a special file with permission
restrictions.

3) Only the owner of the mailbox has access to it. When Alice, a user, needs to send a
message to Bob, another user, Alice runs a user agent (UA) program to prepare the
message and store it in Bob's mailbox as shown in fig 5.1.

4) The message has the sender and recipient mailbox addresses (names of files).

5) Bob can retrieve and read the contents of his mailbox at his convenience, using a user
agent (for an example traditional memo exchange between employees in an office).

Fig First scenario in electronic mail


6. The sender and the receiver of the e-mail are users (or application programs) on two
different systems. The message needs to be sent over the Internet. Here we need user agents
(UAs) and message transfer agents (MTAs), as shown in Fig.5.2.

Fig. UAs and MTAs

7. When the sender is connected to the mail server via a LAN or a WAN, we need two
UAs and two pairs of MTAs (client and server).In the most common scenario, Bob is
also connected to his mail server by a WAN or a LAN.

8. Bob uses an MAA client to retrieve his messages. When both sender and receiver are
connected to the mail server via a LAN or a WAN, we need two UAs, two pairs of
MTAs (client and server), and a pair of MAAs (client and server). This is the most
common situation today as shown in fig.below.
User Agent

It provides service to the user to make the process of sending and receiving a message
easier.

Services Provided by a User Agent

A user agent is a software package (program) that composes, reads, replies to, and
forwards messages. It also handles mailboxes.

Composing Messages: A user agent helps the user compose the e-mail message to be sent
out.

Reading Messages: When a user invokes a user agent, it first checks the mail in the
incoming mailbox. Each e-mail contains the following fields.
A number field.

A flag field that shows the status of the mail such as new, already read but not replied to, or
read and replied to.

The size of the message.

The sender.

The optional subject field.

5. Replying to Messages: After reading a message, a user can use the user agent to
reply to a message. The reply message may contain the original message and the
new message.

6. Forwarding Messages: Forwarding is defined as sending the message to a third


party.
7. Handling Mailboxes: A user agent normally creates two mailboxes: an inbox and
an outbox. The inbox keeps all the received e-mails and outbox keeps all the sent e-
mails

User Agent Types

There are two types of user agent:

Command-driven: It accepts a one-character command from the keyboard to


perform its task. Some examples of command-driven user agents are mail, pine
(program for internet news email), and elm.

GUI-based: They contain graphical-user interface (GUI) components that allow the
user to interact with the software by using both the keyboard and the mouse. Some
examples of GUI-based user agents are Eudora, Microsoft's Outlook, and Netscape.

Sending Mail

To send mail, the user, through the UA, creates mail that looks very similar to postal mail. It has an envelope
and a message as in fig.5.4.

fomating main
Envelope: It contains the sender and the receiver addresses.

Message: It contains the header and the body.

Receiving Mail: The user agent is triggered by the user (or a timer). If a user has mail, the
UA informs the user with a notice.

Addresses: The address consists of two parts: a local part and a domain name, separated
by an @ sign as in fig.5.5.

Multipurpose Internet Mail Extensions (MIME)

Electronic mail has a simple structure. It can send messages only in NVT (Network Virtual Terminal) 7-bit
ASCII format.

For example, it cannot be used for languages that are not supported by 7-bit ASCII
characters (such as French, German, Hebrew, Russian, Chinese, and Japanese).

Multipurpose Internet Mail Extensions (MIME) is a supplementary protocol that transforms non-ASCII
data at the sender site to NVT ASCII data and delivers them to the client MTA to be sent through the
Internet as in fig.5.6.

MIME defines five headers that can be added to the original e-mail header section to define
the transformation parameters.

Fig.5.6 MIME
MIME-Version: This header defines the version of MIME used. The current version is
1.1. MIME-Version:1.1

ontent-Type: This header defines the type of data used in the body of the message.

The content type and the content subtype are separated by a slash. Depending on the
subtype, the header may contain other parameters.

Content-Type<type Jsubtype; parameters>

Content-Transfer-Encoding: This header defines the method used to encode the messages
into 0s and 1s for transport:

Content-Transfer-Encoding :< type>

Content-Id This header uniquely identifies the whole message in a multiple-message


environment.

Content-Id: id=<content-id>

Content-Description: This header defines whether the body is image, audio, or video.

Content-Description :< description>

Message Access Agent: POP and IMAP

Currently two message access protocols are available: Post Office Protocol, version 3(POP3)
and Internet Mail Access Protocol, version 4 (IMAP4). Fig.5.7 shows the position of POP3 protocol in
the most common situation.
Fig.5.7 POP3 and SMTP

You might also like