CN V Unit Notes
CN V Unit Notes
Transport Layer :
FEATURES
UDP is used when acknowledgement of data does not hold any significance.
UDP is stateless.
UDPHeader
Source Port - This 16 bits information is used to identify the source port of the
packet.
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
Kerberos
TRANSMISSION CONTROL PROTOCOL (TCP):
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 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.
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.
o CWR - When a host receives packet with ECE bit set, it sets Congestion
Windows Reduced to acknowledge that ECE received.
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 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:
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.
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:
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.
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.
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 :
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 :
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.
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.
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.
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:
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).
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
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 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.
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.
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.
–
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
Sockets
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.
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.
1. The World Wide Web (WWW) is a repository of information linked together from
points all over the world.
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
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.
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):
2) The controller receives input from the keyboard or the mouse and uses the
client programs to access the document as in fig.
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.
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 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.
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
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 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
– 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.
1. The Hypertext Transfer Protocol (HTTP) is a protocol used mainly to access data
on the World Wide Web.
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.
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.
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.
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)
Generic protocols use World Wide Web resources identified by URIs and access via
HTTP.
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
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) 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
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
4) The second and third byte defines the size of the block in bytes.
Compressed mode
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
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
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
2. This connection is established between the Data Transfer Process (DTP) of client and
server
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
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).
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.
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 sender.
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.
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.
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.
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-Transfer-Encoding: This header defines the method used to encode the messages
into 0s and 1s for transport:
Content-Id: id=<content-id>
Content-Description: This header defines whether the body is image, audio, or video.
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