SlideShare una empresa de Scribd logo
1 de 125
Course code: COE351
Course title : Computer Networks
PART: 2
Prof. Taymoor Mohamed Nazmy
Dept. of computer science, faculty of computer science, Ain Shams uni.
Ex-vice dean of post graduate studies and research Cairo, Egypt
1
Introduction to Network protocols, and
the internet protocols
2
Communications Protocol
• All communications between devices require that the devices agree on the
format of the data. The set of rules defining a format is called a protocol.
At the very least, a communications protocol functions must define the
following:
• rate of transmission (in baud or bps), addressing, Ordered delivery
• whether transmission is to be synchronous or asynchronous ,
• whether data is to be transmitted in half-duplex or full-duplex mode
• In addition, protocols can include sophisticated techniques
• for detecting and recovering from transmission errors
• and for encoding and decoding data.
• A list of the protocols used by a certain system, one protocol per layer, is
called a protocol stack
Network protocols
• The following articles contain lists of network protocols
• WIFI/WIMAX Protocols
• Bluetooth protocol
• Fibre Channel network protocols
• Internet Protocol Suite or TCP/IP model or TCP/IP stack
• Routing protocols
• SSH Secure Shell
• SMB Server Message Block, one version of which was also known
as CIFS (Common Internet File System)
• FTP File Transfer Protocol
• SMTP Simple Mail Transfer Protocol
• TCP Transmission Control Protocol
• Telnet Teletype Network
4
• HTTP Hyper Text Transfer Protocol
• HTTPs Secure Hyper Text Transfer Protocol
• POP Post Office Protocol
• MTP Media Transfer Protocol
• SFTP Secure File Transfer Protocol
• SSL Secure Socket Layer
• TLS Transport Layer Security
• E6 Ethernet globalization protocols
• NTP Network time protocol
• PPP Point to Point Protocol
• NNTP Network News Transfer Protocol
• IMAP Internet Message Access Protocol
• Bitcoin Protocol Protocol for Bitcoin transactions and
transfers on the web
5
Request for Comments (RFC)
• Memos in the Requests for Comments (RFC) document series
contain technical and organizational notes about the Internet. They
cover many aspects of computer networking, including protocols,
procedures, programs, and concepts, as well as meeting notes,
opinions. . Each protocol has its own RFC number, it may contain a
huge amount of information about this protocol.
• The index of RFC can be found blew
• https://www.rfc-editor.org/rfc-index.html
• RFC 2616 for HTTP protocol can be found in
• https://tools.ietf.org/html/rfc2616
7
Understanding the OSI Model
• In an effort to identify and standardize all the levels
of communication needed in networking, ISO
developed a networking model called the Open
Systems Interconnection (OSI) reference model.
• The OSI reference model provides a universally
accepted reference illustrating how data is transmitted
on a network or between two or more networked
devices.
8
The OSI model layers
8
TCP/IP Protocol Suite 9
TCP/IP PROTOCOL SUITE
The TCP/IP protocol suite was developed prior to the OSI
model. Therefore, the layers in the TCP/IP protocol suite
do not match exactly with those in the OSI model.
The original TCP/IP protocol suite was defined as four
software layers built upon the hardware. Today, however,
TCP/IP is thought of as a five-layer model with the layers
named similarly to the ones in the OSI model.
9
TCP/IP Model
Application Layer
Application programs using the network
Transport Layer (TCP/UDP)
Management of end-to-end message transmission,
error detection and error correction
Network Layer (IP)
Handling of datagrams : routing and congestion
Data Link Layer
Management of cost effective and reliable data delivery,
access to physical networks
Physical Layer
Physical Media 10
11
The TCP/IP model
with different name for layer 3 and 4 and
no physical layer showed in
How TCP/IP talk to each other
• TCP/IP has four layers. Programs talk to the
Application layer. On the Application layer
you will find Application protocols such as
SMTP (for e-mail), FTP (for file transfer) and
HTTP (for web browsing).
• Each kind of program talks to a different
Application protocol, depending on the
program purpose.
• After processing the program request, the protocol
on the Application layer will talk to another
protocol from the Transport layer, usually TCP.
• This layer is in charge of getting data sent by the
upper layer, dividing them into packets and
sending them to the layer below, Internet.
• Also, during data reception, this layer is in charge
of putting the packets received from the network
in order (because they can be received out-of-
order) and also checking if the contents of the
packets are intact.
How TCP/IP talk to each other
• On the network layer we have the IP (Internet
Protocol), which gets the packets received from the
Transport layer and adds virtual address information,
i.e., adds the address of the computer that is sending
data and the address of the computer that will receive
this data.
• These virtual addresses are called IP addresses. Then
the packet is sent to the lower layer, link layer. On
this layer packets are called datagrams.
How TCP/IP talk to each other
• The link layer will get the packets sent by
network and send them over the network (or
receive them from the network, if the computer
is receiving data).
How TCP/IP talk to each other
Data encapsulation - During a transmission, data crosses each one of the layers at
the source machine. At each layer, a piece of information is added to the data
packet, this is the header, a collection of information which guarantees
transmission.
At the destination machine, when passing through each layer, the header is read,
and then deleted. So, upon its receipt, the message is in its original state.
At each level, the data packet changes aspect, because a header is added to it, so
the designations change according to the layers:
 The data packet is called a message at Application Layer
 The message is then encapsulated in the form of a segment in the Transport
Layer
 Once the segment is encapsulated in the Internet Layer it takes the name of
datagram
 Finally, we talk about a frame at the Link Layer
Data Encapsulation
18
Data Encapsulation
• As data is moving down the protocol stack, each protocol is
adding layer-specific control information
HTTP
TCP
IP
Ethernet
User data
User dataHTTP Header
TCP Header
TCP HeaderIP Header
TCP HeaderIP Header
Ethernet
Header
Ethernet
Trailer
IP datagram
TCP segment
Ethernet frame
User dataHTTP Header
User dataHTTP Header
User dataHTTP Header
19
Protocol Data Units (PDU)
• User data is passed from layer to layer
• Control information is added/removed to/from user
data at each layer
—Header (and sometimes trailer)
—each layer has a different header/trailer
• Data + header + trailer = PDU (Protocol Data Unit)
—This is basically what we call packet
—each layer has a different PDU
19
20
Assignment of Protocols to Layers
Network
Layer
Routing Protocols
PIM
OSPF
RIP
Application
Layer
Data Link
Layer
IP
ARP Ethernet
Network
Interface
Transport
Layer
TCP UDP
SNMPFTP DNSHTTP
ICMP
IGMP
ping
application
Telnet
DHCP
Layers Addresses
21
21
Address Example Software Example Address
Application Layer Web browser ike.ba.ttu.edu
Transport Layer HTTP (Port address) 80
Network Layer TCP/IP (IP address) 129.118.49.189
Data Link Layer Ethernet MAC address 00-A0-C9-96-1D-90
IP
MAC
22
• A user on host argon.tcpip-lab.edu (“Argon”) makes a web
access to URL
http://Neon. tcpip-lab.edu/index.html.
•
• What actually happens in the network?
Sending data scenario
over the TCP/IP
23
HTTP Request and HTTP response
• Web browser runs an HTTP client program
• Web server runs an HTTP server program
• HTTP client sends an HTTP request to HTTP server
• HTTP server responds with HTTP response
HTTP client
Argon
HTTP server
Neon
HTTP request
HTTP response
24
From HTTP to TCP
• To send request, HTTP client program establishes an
TCP connection to the HTTP server Neon.
• The HTTP server at Neon has a TCP server running
HTTP client
TCP client
Argon
HTTP server
TCP server
Neon
HTTP request / HTTP response
TCP connection
25
Resolving hostnames and port numbers
• Since TCP does not work with hostnames and also
would not know how to find the HTTP server
program at Neon, two things must happen:
1. The name “neon.tcpip-lab.edu” must be
translated into a 32-bit IP address.
2. The HTTP server at Neon must be identified
by a 16-bit port number.
26
Translating a hostname into an IP
address
• The translation of the hostname neon.tcpip-lab.edu into
an IP address is done via a database lookup
• The distributed database used is called the Domain
Name System (DNS)
• All machines on the Internet have an IP address:
argon.tcpip-lab.edu 128.143.137.144
neon.tcpip-lab.edu 128.143.71.21
HTTP client DNS Server
argon.tcpip-lab.edu 128.143.136.15
neon.tcpip-lab.edu
128.143.71.21
27
Finding the port number
• Note: Most services on the Internet are reachable
via well-known ports. E.g. All HTTP servers on
the Internet can be reached at port number “80”.
• So: Argon simply knows the port number of the
HTTP server at a remote machine.
• The well-known port numbers of some of the most
popular services are:
ftp 21 finger 79
telnet 23 http 80
smtp 25 nntp 119
28
Requesting a TCP Connection
• The HTTP client at argon.tcpip-lab.edu requests the TCP
client to establish a connection to port 80 of the
machine with address 128.141.71.21
HTTP client
TCP client
argon.tcpip-lab.edu
Establish a TCP connection
to port 80 of 128.143.71.21
29
Invoking the IP Protocol
• The TCP client at Argon
sends a request to establish
a connection to port 80 at
Neon
• This is done by asking its
local IP module to send an
IP datagram to 128.143.71.21
• (The data portion of the IP datagram
contains the request to open a connection)
TCP client
argon.tcpip-lab.edu
IP
Send an IP datagram to
128.143.71.21
30
Sending the IP datagram to an IP router
• Argon (128.143.137.144) can deliver the IP datagram directly
to Neon (128.143.71.21), only if it is on the same local
network (“subnet”)
• But Argon and Neon are not on the same local network
• So, Argon sends the IP datagram to its default gateway
• The default gateway is an IP router
• The default gateway for Argon is Router137.tcpip-
lab.edu (128.143.137.1).
31
The route from Argon to Neon
• Note that the gateway has a different name for each of
its interfaces.
32
Finding the MAC address of the gateway
• To send an IP datagram to Router137, Argon puts the IP
datagram in an Ethernet frame, and transmits the frame.
• However, Ethernet uses different addresses, so-called Media
Access Control (MAC) addresses (also called: physical
address, hardware address)
• Therefore, Argon must first translate the IP address 128.143.137.1
into a MAC address.
• The translation of addressed is performed via the Address
Resolution Protocol (ARP)
33
Address resolution with ARP
34
Invoking the device driver
• The IP module at Argon, tells its Ethernet device
driver to send an Ethernet frame to address
00:e0:f9:23:a8:20
argon.tcpip-lab.edu
IP module
Ethernet
Send an Ethernet frame
to 00:e0:f9:23:a8:20
35
Sending an Ethernet frame
• The Ethernet device driver of Argon sends the Ethernet frame
to the Ethernet network interface card (NIC)
• The NIC sends the frame onto the wire
36
Forwarding the IP datagram
• The IP router receives the Ethernet frame at interface 128.143.137.1,
recovers the IP datagram and determines that the IP datagram should
be forwarded to the interface with name 128.143.71.1
• The IP router determines that it can deliver the IP datagram directly
37
Another lookup of a MAC address
• The router needs to find the MAC address of Neon.
• Again, ARP is invoked, to translate the IP address of Neon (128.143.71.21)
into the MAC address of neon (00:20:af:03:98:28).
38
Invoking the device driver at the router
• The IP protocol at Router71, tells its Ethernet
device driver to send an Ethernet frame to
address 00:20:af:03:98:28
router71.tcpip-lab.edu
IP module
Ethernet
Send a frame to
00:20:af:03:98:28
39
Sending another Ethernet frame
• The Ethernet device driver of Router71 sends the
Ethernet frame to the Ethernet NIC, which
transmits the frame onto the wire.
40
Data has arrived at Neon
• Neon receives the Ethernet frame
• The payload of the Ethernet frame
is an IP datagram which is passed to
the IP protocol.
• The payload of the IP datagram is a
TCP segment, which is passed to
the TCP server
• Note: Since the TCP segment is a connection request
(SYN), the TCP protocol does not pass data to the HTTP
program for this packet. Instead, the TCP protocol at
neon will respond with a SYN segment to Argon.
HTTP server
Neon.cerf.edu
TCP server
IP module
Ethernet
41
Layers in the Example
HTTP
TCP
IP
argon.tcpip-
lab.edu
128.143.137.144
Ethernet Ethernet Ethernet
IP
HTTP
TCP
IP
neon.tcpip-lab.edu
128.143.71.21
Ethernet
router71.tcpip-
lab.edu
128.143.137.1
00:e0:f9:23:a8:20
router137.tcpip-
lab.edu
128.143.71.1
Send HTTP Request to
neon
Establish a connection to 128.143.71.21 at port
80 Open TCP connection to
128.143.71.21 port 80
Send a datagram (which contains a connection
request) to 128.143.71.21
Send IP datagram to
128.143.71.21
Send the datagram to 128.143.137.1
Send Ethernet frame to
00:e0:f9:23:a8:20
Send Ethernet frame to
00:20:af:03:98:28
Send IP data-gram to
128.143.71.21
Send the datagram
to 128.143.7.21
Frame is an IP
datagram
Frame is an IP
datagram
IP datagram is a TCP
segment for port 80
Application layer
42
Application layer
• This layer makes the communication between
programs and the transport protocols. There are
several different protocols that work on the
Application layer.
• The most known are HTTP (HyperText Transfer
Protocol), SMTP (Simple Mail Transfer Protocol),
FTP (File Transfer Protocol), SNMP (Simple
Network Management Protocol), DNS (Domain
Name System) and Telnet. You may have already
seen these names before.
• The Application layer talks to the Transport
layer through a port. Ports are numbered and
standard applications always use the same
port.
• For example, SMTP protocol always use port
25, HTTP protocol always use port 80 and FTP
protocol always use ports 20 (for data
transmission) and 21 (for control).
Common Port Numbers

FTP – 20-21
Telnet – 23
SMTP – 25
DNS – 53 (Both TCP & UDP)
HTTP – 80
DHCP – 67 & 68
POP – 110
A port is an endpoint of communication in an operating
system, Specific port numbers are often used to identify
specific services.
Application layer Protocols
 FTP – allows the download/upload of files
between a client/server
 DHCP – assigns IP addresses, subnet masks,
default gateways, DNS servers, etcs. To users as
they login the network
 DNS – Matches domain names with IP addresses
 SMTP & POP3 – used to send email messages
from clients to servers over the internet
 Telnet – allows users to login to a host from a
remote location and take control as if they were
sitting at the machine (virtual connection)
 HTTP – Used to transfer data between
clients/servers using a web browser
48
2-49
Some network apps
 e-mail
 web
 text messaging
 remote login
 P2P file sharing
 multi-user network games
 streaming stored video
(YouTube, Hulu, Netflix)
 voice over IP (e.g., Skype)
 real-time video
conferencing
 social networking
 search
 …
 …
49
2-50
Creating a network app
write programs that:
• run on (different) end systems
• communicate over network
• e.g., web server software
communicates with browser
software
no need to write software for
network-core devices
• network-core devices do not
run user applications
• applications on end systems
allows for rapid app
development, propagation
application
transport
network
data link
physical
application
transport
network
data link
physical
application
transport
network
data link
physical
51
Client-server paradigm
Typical network app has two pieces:
client and server
application
transport
network
data link
physical
application
transport
network
data link
physical
Client:
 initiates contact with server (“speaks
first”)
 typically requests service from
server,
 for Web, client is implemented in
browser; for e-mail, in mail reader
Server:
 provides requested service to client
 e.g., Web server sends requested
Web page, mail server delivers e-
mail
request
reply
52
Some Web terms
• Web page:
– consists of “objects”
– addressed by a URL
• Most Web pages consist
of:
– base HTML page, and
– several referenced
objects.
• URL has two components:
host name and path name:
• User agent for Web is called a
browser:
– MS Internet Explorer
– Netscape Communicator
• Server for Web is called Web
• server:
– Apache (public domain)
– MS Internet Information
Server
2-53
Web and HTTP
First, a review…
• web page consists of objects
• object can be HTML file, JPEG image, Java
applet, audio file,…
• web page consists of base HTML-file which
includes several referenced objects
• each object is addressable by a URL, e.g.,
www.someschool.edu/someDept/pic.gif
host name path name
54
Web Caches (proxy server)
• user sets browser: Web
accesses via web cache
• client sends all http requests to
web cache
– if object at web cache, web
cache immediately returns
object in http response
– else requests object from
origin server, then returns http
response to client
Goal: satisfy client request without involving origin server
client
Proxy
server
client
origin
server
origin
server
Domain Name System (DNS)
• The Domain Name System (DNS) is a hierarchical
decentralized naming system for computers, services, or
other resources connected to the Internet or a private
network.
• It associates various information with domain names
assigned to each of the participating entities.
• Most prominently, it translates more readily memorized
domain names to the numerical IP addresses needed for
locating and identifying computer services and devices with
the underlying network protocols.
How DNS work
 , an application program:
 Calls a library procedure called the resolver, passing it the
name as a parameter
 The resolver sends a UDP packet to a local DNS server
 DNS server looks up the name and returns the IP address to
the resolver
 Resolver returns it to the application
 Armed with the IP address, the program can then establish a
TCP connection with the destination or send it UDP packets
56
DSN Services and Protocol
DNS Servers resolve names to IP addresses. It would be
difficult to remember the IP address of every website we like to
visit, but we can remember names.
57
15-58
Domain Name System
• The very last section of the domain is called its top-
level domain (TLD) name
60
FTP: the file transfer protocol
• transfer file to/from remote host
• client/server model
– client: side that initiates transfer (either to/from remote)
– server: remote host
file transfer
FTP
server
FTP
user
interface
FTP
client
local file
system
remote file
system
user
at host
61
FTP: separate control, data connections
• ftp client contacts ftp server at
port 21, specifying TCP as
transport protocol
• two parallel TCP connections
opened:
– control: exchange
commands, responses
between client, server.
“out of band control”
– data: file data to/from server
FTP
client
FTP
server
TCP control connection
port 21
TCP data connection
port 20
E-mail services and SMTP/POP protocols
• E-mail is the most popular network service.
• E-mail client (when people compose e-mail) is called
Mail User Agent (MUA)
• MUA allows messages to be sent/retrieved to and
from your mailbox
• Requires several applications and services
– POP or POP3 – deliver email from server to client
(incoming messages)
– SMTP – handles outbound messages from clients
62
E-mail services and SMTP/POP protocols
• What do servers require?
1) Must be running SMTP!
2) Also operates
1) Mail Transfer Agent (MTA) – used to forward email
1) Receives email from the clients MUA
2) Uses SMTP to route email between SERVERS!
3) Passes email to the MDA for final delivery
2) Mail Delivery Agent (MDA) – receives messages from MUA
or from the MTA on another server
3) For two e-mail servers to talk – MUST run SMTP and
MTA in order to transfer mail between the 2 servers!
63
E-mail services and SMTP/POP protocols
64
DHCP
• The Dynamic Host Configuration Protocol
(DHCP) is a standardized network protocol. The
DHCP is controlled by a DHCP server that
dynamically distributes network configuration
parameters, such as IP addresses, for interfaces and
services.
• A router or a residential gateway can be enabled to
act as a DHCP server.
65
• A DHCP server enables computers to request
IP addresses and networking parameters
automatically, reducing the need for a network
administrator or a user to configure these
settings manually.
• In the absence of a DHCP server, each
computer or other device on the network needs
to be manually assigned to an IP address.
Telnet
• TELNET is an abbreviation for TErminaL NETwork. It is the standard
TCP/IP protocol for virtual terminal service as proposed by ISO.
• TELNET enables the establishment of a connection to a remote system
in such a way that the local terminal appears to be a terminal at the
remote system
• Uses a client/server model to define a standard way in which to interact
with a remote system.
• The telnet protocol is the basis for many protocols
– FTP, HTTP, SMTP.
– TELNET is a protocol that provides “a general, bi-directional,
communications facility.
67
68
Remote login
Transport Layer
69
Purpose of Transport Layer
1) Tracking the individual communication between
applications on the source and destination hosts: Any host
may have multiple applications that are communicating
across the network.
Each of these applications will be communicating with one
or more applications on remote hosts.
It is the responsibility of the Transport layer to maintain
the multiple communication streams between these
applications.
2) Segmenting data and managing each piece: As
each application creates a stream data to be
sent to a remote application, this data must be
prepared to be sent across the media in
manageable pieces.
The Transport layer protocols describe services
that segment this data from the Application
layer. This includes the encapsulation required
on each piece of data.
Each piece of application data requires headers
to be added at the Transport layer to indicate to
which communication it is associated.
3)Reassembling the segments into streams
of application data: At the receiving host,
each piece of data may be directed to the
appropriate application.
Additionally, these individual pieces of
data must also be reconstructed into a
complete data stream that is useful to the
Application layer.
• The protocols at the Transport layer
describe the how the Transport layer
header information is used to reassemble
the data pieces into streams to be passed
to the Application layer.
4) Identifying the different applications: In order to pass
data streams to the proper applications, the Transport
layer must identify the target application.
To accomplish this, the Transport layer assigns an
application an identifier. The TCP/IP protocols call this
identifier a port number.
Each software process that needs to access the network is
assigned a port number unique in that host. This port
number is used in the transport layer header to indicate
to which application that piece of data is associated.
Reliable Communication
In networking terms, reliability means ensuring that each piece
of data that the source sends arrives at the destination.
At the Transport layer the three basic operations of
reliability are:
a) tracking transmitted data
b) acknowledging received data
c) retransmitting any unacknowledged data
This requires the processes of Transport layer of the source to
keep track of all the data pieces of each conversation and the
retransmit any of data that did were not acknowledged by
the destination.
The Transport layer of the receiving host must also
track the data as it is received and acknowledge
the receipt of the data.
These reliability processes place additional
overhead on the network resources due to the
acknowledgement, tracking, and retransmission.
To support these reliability operations, more control
data is exchanged between the sending and
receiving hosts. This control information is
contained in the Transport Layer header.
Determining the Need for Reliability
Applications, such as databases, web pages, and e-mail,
require that all of the sent data arrive at the destination in
its original condition, in order for the data to be useful.
Any missing data could cause a corrupt communication
that is either incomplete or unreadable.
Therefore, these applications are designed to use a
Transport layer protocol that implements reliability.
The additional network overhead is considered to be
required for these applications.
• Other applications are more tolerant of the loss
of small amounts of data.
• For example, if one or two segments of a video
stream fail to arrive, it would only create a
momentary disruption in the stream.
• This may appear as distortion in the image but
may not even be noticeable to the user.
Ports
* The two protocols TCP and UDP based services keep track of the
various applications that are communicating.
To differentiate the segments and datagrams for each application, both TCP
and UDP have header fields that can uniquely identify these applications.
These unique identifiers are the port numbers.
* In the header of each segment or datagram, there is a source and
destination port. The source port number is the number for this
communication associated with the originating application on the local host.
The destination port number is the number for this communication associated
with the destination application on the remote host.
• * Port numbers are assigned in various ways,
depending on whether the message is a request
or a response.
• While server processes have static port
numbers assigned to them, clients dynamically
chooses a port number for each conversation.
• * The combination between IP address and
port number is called socket and it’s unique
connection.
TCP and UDP Protocols
The two most common Transport layer protocols of TCP/IP protocol suite are
Transmission Control Protocol (TCP) and User Datagram Protocol (UDP). Both
protocols manage the communication of multiple applications. The differences
between the two are the specific functions that each protocol implements.
User Datagram Protocol (UDP)
UDP is a simple, connectionless protocol, described in RFC 768. It has the
advantage of providing for low overhead data delivery. The pieces of communication
in UDP are called datagrams. These datagrams are sent as "best effort" by this
Transport layer protocol.
Applications that use UDP include:
Video Streaming
Voice over IP (VoIP)
UDP Protocol
UDP is a simple protocol that provides the basic Transport layer functions. It
much lower overhead than TCP, since it is not connection-oriented and does not
provide the sophisticated retransmission, sequencing, and flow control mechanisms.
This does not mean that applications that use UDP are always unreliable. It
simply means that these functions are not provided by the Transport layer protocol
and must be implemented elsewhere if required.
Although the total amount of UDP traffic found on a typical network is often
relatively low, key Application layer protocols that use UDP include:
Domain Name System (DNS)
Simple Network Management Protocol (SNMP)
Dynamic Host Configuration Protocol (DHCP)
Routing Information Protocol (RIP)
Trivial File Transfer Protocol (TFTP)
• Some applications, such as online games or VoIP, can
tolerate some loss of some data. If these applications used
TCP, they may experience large delays while TCP detects
data loss and retransmits data.
• These delays would be more detrimental to the application
than small data losses. Some applications, such as DNS,
will simply retry the request if they do not receive a
response, and therefore they do not need TCP to guarantee
the message delivery.
• The low overhead of UDP makes it very desirable for such
applications.
UDP Datagram Structure
* Source port: This field identifies the sending port when meaningful and should be
assumed to be the port to reply to if needed. If not used, then it should be zero.
* Destination port: This field identifies the destination port and is required.
* Length: A 16-bit field that specifies the length in bytes of the entire datagram:
header and data. The minimum length is 8 bytes since that's the length of the header.
* Checksum: The 16-bit checksum field is used for error-checking of the header and
data.
Transmission Control Protocol (TCP)
• TCP is a connection-oriented protocol, described in Request
for Comments (RFC 793).
• TCP incurs additional overhead to gain functions.
Additional functions specified by TCP are the same order
delivery, reliable delivery, and flow control.
• Each TCP segment has 20 bytes of overhead in the header
encapsulating the Application layer data, whereas each UDP
segment only has 8 bytes of overhead.
• Applications that use TCP are:
• Web Browsers
• E-mail
• File Transfers
Transmition Control Protocol (TCP)
The reliability of TCP communication is performed using connection-
oriented sessions. Before a host using TCP sends data to another host,
the Transport layer initiates a process to create a connection with the
destination.
* Establishes a session between source host and source
destination (this ensures that each host is prepared and aware for the
connection).
* The destination host sends acknowledgements to the source
for the segments that it receives.
* As the source receives an acknowledgement, it knows that the
data has been successfully delivered and can quit tracking that data.
• * If the source does not receive an acknowledgement
within a predetermined amount of time, it retransmits
that data to the destination.
• * The establishment of the sessions creates
overhead in the form of additional segments being
exchanged.
• * There is also additional overhead on the
individual hosts created by the necessity to keep track
of which segments are awaiting acknowledgement and
by the retransmission process.
91
TCP Format
IP header TCP header TCP data
Sequence number (32 bits)
DATA
20 bytes 20 bytes
0 15 16 31
Source Port Number Destination Port Number
Acknowledgement number (32 bits)
window size
header
length
0 Flags
Options (if any)
TCP checksum urgent pointer
20bytes
TCP segments have a 20 byte header with >= 0 bytes of data.
TCP Segment Structure
* Source port (16 bits) – identifies the sending port
* Destination port (16 bits) – identifies the receiving port
* Sequence number (32 bits) – has a dual role
• If the SYN flag is set, then this is the initial sequence number. The sequence number of the actual first data byte (and the
acknowledged number in the corresponding ACK) will then be this sequence number plus 1.
* If the SYN flag is clear, then this is the sequence number of the first data byte
* Acknowledgment number (32 bits)
* Data offset (4 bits) – specifies the size of the TCP header in 32-bit words
* Reserved (4 bits) – for future use and should be set to zero
• Flags (8 bits) (aka Control bits) – contains 8 1-bit flags
* Window (16 bits) – the size of the receive window, which specifies the number of bytes that the receiver is currently willing to
receive.
* Checksum (16 bits) – The 16-bit checksum field is used for error-checking of the header and data
* Urgent pointer (16 bits) – if the URG flag is set, then this 16-bit field is an offset from the sequence number indicating the last
urgent data byte.
93
Services provided by Internet transport protocols
TCP service:
 connection-oriented: setup
required between client, server
 reliable transport between sending
and receiving process
 flow control: sender won’t
overwhelm receiver
 congestion control: adjust sender
when network overloaded
 does not providing: minimum
bandwidth guarantees
UDP service:
 unreliable data transfer
between sending and
receiving process
 does not provide:
connection setup,
reliability, flow control,
congestion control, or
bandwidth guarantee
93
Connection Termination
Reliable, In-Order
Data Exchange
Connection Establishment
Typical TCP Transaction
Client Server
timetime
 when client creates socket:
 client TCP establishes connection to
server TCP.
 A TCP Transaction consists of 3 Phases
1. Connection Establishment
 Handshaking between client and
server
2. Reliable, In-Order Data Exchange
 Recover any lost data through
retransmissions and ACKs
3. Connection Termination
 Closing the connection
Connection Establishment (cont)
Host A Host B
time
Three-way handshake
Three way handshake:
 Host A sends a TCP
SYNchronize packet to Host B
 Host B receives A's SYN
 Host B sends a SYNchronize-
ACKnowledgement
 Host A receives B's
SYN+ACK
 Host A sends ACKnowledge
 Host B receives ACK.

TCP socket connection is
ESTABLISHED
time
Connection
request
host ACKs
and selects
its own initial
seq #
host ACKs
TCP Connection Termination
Closing a connection:
client closes socket:
clientSocket.close();
Step 1: client end system sends
TCP FIN control segment to
server
Step 2: server receives FIN,
replies with ACK. Server
might send some buffered
before closing the
connection.
Server then sends FIN and
moves to Closing state.
client server
close
Data
write
closed
timedwait close
TCP Connection Termination
Step 3: client receives FIN, replies with ACK.
 Enters “timed wait” - will respond with
ACK to received FINs
Step 4: server, receives ACK. Connection
closed.
 Why wait before closing the connection?
 If the connection were allowed to move
to CLOSED state, then another pair of
application processes might come along
and open the same connection (use the
same port #s) and a delayed FIN from an
earlier incarnation would terminate the
connection.
client server
closing
closing
closedtimedwait
closed
Flow control
• Flow control is a function for the control of the data
flow 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. Thus the
network level also uses flow control to restrict
the flow of network protocol data units .
• Thus flow control becomes a much more
complex issue at the transport layer than at
lower levels like the datalink level.
TCP Flow Control
Flow control assists the reliability of TCP transmission by
adjusting the effective rate of data flow between the two services in the
session.
When the source is informed that the specified amount of data in the
segments is received, it can continue sending more data for this session.
This Window Size field in the TCP header specifies the amount of data
that can be transmitted before an acknowledgement must be received.
The initial window size is determined during the session startup via the
three-way handshake.
• TCP feedback mechanism adjusts the effective
rate of data transmission to the maximum flow
that the network and destination device can
support without loss.
• TCP attempts to manage the rate of
transmission so that all data will be received
and retransmissions will be minimized.
Reducing Window Size
* Another way to control the data flow is to use dynamic
window sizes. When network resources are constrained, TCP can
reduce the window size to require that received segments be
acknowledged more frequently.
This effectively slows down the rate of transmission because the
source waits for data to be acknowledged more frequently.
* The TCP receiving host sends the window size value to
the sending TCP to indicate the number of bytes that it is prepared
to receive as a part of this session.
• If the destination needs to slow down the rate
of communication because of limited buffer
memory, it can send a smaller window size
value to the source as part of an
acknowledgement.
24.106
CONGESTION
Congestion in a network may occur if the load on the
network—the number of packets sent to the network—
is greater than the capacity of the network—the number
of packets a network can handle.
Congestion control refers to the mechanisms and
techniques to control the congestion and keep the load
below the capacity.
106
24.107
CONGESTION CONTROL
Congestion control refers to techniques and
mechanisms that can either prevent congestion,
before it happens, or remove congestion, after it
has happened.
In general, we can divide congestion control
mechanisms into two broad categories: open-
loop congestion control (prevention) and closed-
loop congestion control (removal).
107
108
Congestion Control vs. Flow Control
• They are highly related to each other. The difference is
subtle.
• Congestions control is a global issue, involving all
hosts, routers, and other factors
• Flow control relates to the point-to-point traffic
• between a given sender and a given receiver, making
sure a faster sender won’t swamp a slow receiver.
109
Congestion Control Causes
• Congestion is a problem when too many packets are
present in the subnet, performance degrades
• Congestions can be brought on by several factors:
– All of a sudden, streams of packets arrive on multiple input lines
and all of them need the same output line, a queue is built up.
Allocating more memory may help to a point but with infinite
memory, congestion gets worse because packets are timed out.
– Slow processors make queue to be built up even though there are
enough bandwidth.
– Low-bandwidth also causes congestion.
• Network congestion in data networking quality of service
that occurs when a network node is carrying more data than
it can handle.
• A consequence of congestion is that an incremental increase
in offered load leads either only to a small increase or even
a decrease in network throughput.
• Network protocols that use aggressive retransmissions to
compensate for packet loss due to congestion can increase
congestion, even after the initial load has been reduced to a
level that would not normally have induced network
congestion.
• Such networks exhibit two stable states under the same
level of load. The stable state with low throughput is known
as congestive collapse.
• Networks use congestion control and congestion
avoidance techniques to try to avoid collapse. These
include: exponential backoff in protocols such as
CSMA/CA in 802.11 and the original Ethernet, window
reduction in TCP, and fair queueing in devices such as
routers.
• Another method is to implement priority schemes,
transmitting some packets with higher priority than
others.
• A third avoidance method is the explicit allocation of
network resources to specific flows through the use of
admission
112
Solutions for Congestion
• The presence of congestion means that the load is
greater than the resources can handle
• Two solutions
– Increase the resource: increase the bandwidth, Split the
traffic over multiple routes, Put spare routers on-line
– Decrease the traffic: deny service to new users (hire-
freezing), degrade service to some/all users (reduce salary),
drop some users (lay off)
113
Congestion Prevention Policies
Policies that affect congestion.
5-26
Transmission Modes
114
115
Multiplexing and demultiplexing
• Multiplexing is the process in which multiple Data
Streams, coming from different Sources, are
combined and Transmitted over a Single Data
Channel or Data Stream.
• In Electronic Communications, the two basic forms
of Multiplexing are Time Division Multiplexing
(TDM) and Frequency Division Multiplexing (FDM).
• Multiplexing is done by an equipment called
Multiplexer (MUX). It is placed at the Transmitting
End of the communication link.
• At the Receiving End, the Composite Signal is
separated by an equipment called Demultiplexer
(DEMUX). Demultiplexer performs the reverse process
of Multiplexing and routes the separated signals to their
corresponding Receivers or Destinations.
• The Transport layer in TCP/IP model,
• provides multiplexing of several data.
23.118
Multiplexing and demultiplexing
Question
• Which address is used in an internet employing the
TCP/IP protocols?
a) physical address and logical address
b) port address
c) specific address
d) all of the mentioned.
• . TCP/IP model was developed _____ the OSI model.
a) prior to
b) after
c) simultaneous to
d) none of the mentioned.
119
• Which address identifies a process on a host?
a) physical address
b) logical address
c) port address
d) specific address.
• Which layer provides the services to user?
a) application layer
b) session layer
c) presentation layer
d) none of the mentioned.
120
• Transmission data rate is decided by
a) network layer
b) physical layer
c) data link layer
d) transport layer.
• The 4 byte IP address consists of
a) network address
b) host address
c) both (a) and (b)
d) none of the mentioned.
121
• The network layer protocol of internet is
a) ethernet
b) internet protocol
c) hypertext transfer protocol
d) none of the mentioned.
• Transport layer aggregates data from different
applications into a single stream before passing it to
a) network layer
b) data link layer
c) application layer
d) physical layer
122
• Which one of the following is a transport layer protocol
used in internet?
a) TCP
b) UDP
c) both (a) and (b)
d) none of the mentioned.
• . The ____ translates internet domain and host names to IP
address.
a) domain name system
b) routing information protocol
c) network time protocol
d) internet relay chat.
123
• When displaying a web page, the application
layer uses the
a) HTTP protocol
b) FTP protocol
c) SMTP protocol
d) none of the mentioned.
124
End part 2

Más contenido relacionado

La actualidad más candente

Internet protocols Report Slides
Internet protocols Report SlidesInternet protocols Report Slides
Internet protocols Report Slides
Bassam Kanber
 
What is TCP/IP
What is TCP/IPWhat is TCP/IP
What is TCP/IP
farhan516
 

La actualidad más candente (20)

Internet protocols Report Slides
Internet protocols Report SlidesInternet protocols Report Slides
Internet protocols Report Slides
 
Network protocol
Network protocolNetwork protocol
Network protocol
 
Tcpip services and applications
Tcpip services and applicationsTcpip services and applications
Tcpip services and applications
 
Protocols
Protocols Protocols
Protocols
 
TCP/IP Introduction
TCP/IP Introduction TCP/IP Introduction
TCP/IP Introduction
 
TCP/IP Models
TCP/IP ModelsTCP/IP Models
TCP/IP Models
 
TCP/IP model
TCP/IP modelTCP/IP model
TCP/IP model
 
Network Protocol and TCP/IP
Network Protocol and TCP/IPNetwork Protocol and TCP/IP
Network Protocol and TCP/IP
 
TCP/IP Basics
TCP/IP BasicsTCP/IP Basics
TCP/IP Basics
 
Module 1 slides
Module 1 slidesModule 1 slides
Module 1 slides
 
Cs553 st7 ch18-internet_protocols
Cs553 st7 ch18-internet_protocolsCs553 st7 ch18-internet_protocols
Cs553 st7 ch18-internet_protocols
 
TCP / IP Services and Standards
TCP / IP Services and StandardsTCP / IP Services and Standards
TCP / IP Services and Standards
 
Tcp ip-ppt
Tcp ip-pptTcp ip-ppt
Tcp ip-ppt
 
TCP-IP PROTOCOL
TCP-IP PROTOCOLTCP-IP PROTOCOL
TCP-IP PROTOCOL
 
TCP/IP(networking)
TCP/IP(networking)TCP/IP(networking)
TCP/IP(networking)
 
TCP/IP Protocol Architeture
TCP/IP Protocol ArchitetureTCP/IP Protocol Architeture
TCP/IP Protocol Architeture
 
TCP - Transmission Control Protocol
TCP - Transmission Control ProtocolTCP - Transmission Control Protocol
TCP - Transmission Control Protocol
 
Protocols and the TCP/IP Protocol Suite
Protocols and the TCP/IP Protocol SuiteProtocols and the TCP/IP Protocol Suite
Protocols and the TCP/IP Protocol Suite
 
Protocol architecture TCP IP
Protocol architecture TCP IPProtocol architecture TCP IP
Protocol architecture TCP IP
 
What is TCP/IP
What is TCP/IPWhat is TCP/IP
What is TCP/IP
 

Similar a Computer network coe351- part2- final

Web technologies: recap on TCP-IP
Web technologies: recap on TCP-IPWeb technologies: recap on TCP-IP
Web technologies: recap on TCP-IP
Piero Fraternali
 
Notes e commerce
Notes e commerceNotes e commerce
Notes e commerce
S S
 
New tcp-ip model (2)
New tcp-ip model (2)New tcp-ip model (2)
New tcp-ip model (2)
Nitesh Singh
 
The TCP/IP and OSI models
The TCP/IP and OSI modelsThe TCP/IP and OSI models
The TCP/IP and OSI models
Jake Weaver
 

Similar a Computer network coe351- part2- final (20)

Web technologies: recap on TCP-IP
Web technologies: recap on TCP-IPWeb technologies: recap on TCP-IP
Web technologies: recap on TCP-IP
 
Unit 2 ppt-idc
Unit 2 ppt-idcUnit 2 ppt-idc
Unit 2 ppt-idc
 
Sargation university's open system interconnection
Sargation university's open system interconnectionSargation university's open system interconnection
Sargation university's open system interconnection
 
Tcp/Ip Model
Tcp/Ip ModelTcp/Ip Model
Tcp/Ip Model
 
Notes e commerce
Notes e commerceNotes e commerce
Notes e commerce
 
lecture 4.pptx
lecture 4.pptxlecture 4.pptx
lecture 4.pptx
 
Osi
OsiOsi
Osi
 
Aplication and Transport layer- a practical approach
Aplication and Transport layer-  a practical approachAplication and Transport layer-  a practical approach
Aplication and Transport layer- a practical approach
 
Chapter 9 TCP IP Reference Model.ppt
Chapter 9 TCP IP Reference Model.pptChapter 9 TCP IP Reference Model.ppt
Chapter 9 TCP IP Reference Model.ppt
 
Chapter 9 TCP IP Reference Model.ppt
Chapter 9 TCP IP Reference Model.pptChapter 9 TCP IP Reference Model.ppt
Chapter 9 TCP IP Reference Model.ppt
 
Lecture 3- tcp-ip
Lecture  3- tcp-ipLecture  3- tcp-ip
Lecture 3- tcp-ip
 
TCP/IP Modal
TCP/IP ModalTCP/IP Modal
TCP/IP Modal
 
02 coms 525 tcpip - introduction to tcpip
02   coms 525 tcpip -  introduction to tcpip02   coms 525 tcpip -  introduction to tcpip
02 coms 525 tcpip - introduction to tcpip
 
networking and computer security prasantation
networking  and computer  security  prasantationnetworking  and computer  security  prasantation
networking and computer security prasantation
 
Bhargava Presentation.ppt
Bhargava Presentation.pptBhargava Presentation.ppt
Bhargava Presentation.ppt
 
Bhargava Presentation.ppt
Bhargava Presentation.pptBhargava Presentation.ppt
Bhargava Presentation.ppt
 
New tcp-ip model
New tcp-ip modelNew tcp-ip model
New tcp-ip model
 
New tcp-ip model (2)
New tcp-ip model (2)New tcp-ip model (2)
New tcp-ip model (2)
 
The TCP/IP and OSI models
The TCP/IP and OSI modelsThe TCP/IP and OSI models
The TCP/IP and OSI models
 
Tcp presentation
Tcp presentationTcp presentation
Tcp presentation
 

Más de Taymoor Nazmy

Más de Taymoor Nazmy (20)

Cognitive systems
Cognitive  systemsCognitive  systems
Cognitive systems
 
Cognitive systems
Cognitive  systemsCognitive  systems
Cognitive systems
 
Artificial intelligent Lec 5-logic
Artificial intelligent Lec 5-logicArtificial intelligent Lec 5-logic
Artificial intelligent Lec 5-logic
 
Artificial intelligent Lec 3-ai chapter3-search
Artificial intelligent Lec 3-ai chapter3-searchArtificial intelligent Lec 3-ai chapter3-search
Artificial intelligent Lec 3-ai chapter3-search
 
Lec 2-agents
Lec 2-agentsLec 2-agents
Lec 2-agents
 
Artificial intelligent Lec 1-ai-introduction-
Artificial intelligent Lec 1-ai-introduction-Artificial intelligent Lec 1-ai-introduction-
Artificial intelligent Lec 1-ai-introduction-
 
Image processing 2
Image processing 2Image processing 2
Image processing 2
 
Image processing 1-lectures
Image processing  1-lecturesImage processing  1-lectures
Image processing 1-lectures
 
Software Engineering Lec 10 -software testing--
Software Engineering Lec 10 -software testing--Software Engineering Lec 10 -software testing--
Software Engineering Lec 10 -software testing--
 
Software Engineering Lec 8-design-
Software Engineering Lec 8-design-Software Engineering Lec 8-design-
Software Engineering Lec 8-design-
 
Software Engineering Lec 7-uml-
Software Engineering Lec 7-uml-Software Engineering Lec 7-uml-
Software Engineering Lec 7-uml-
 
Software Engineering Lec5 oop-uml-i
Software Engineering Lec5 oop-uml-iSoftware Engineering Lec5 oop-uml-i
Software Engineering Lec5 oop-uml-i
 
Software Engineering Lec 4-requirments
Software Engineering Lec 4-requirmentsSoftware Engineering Lec 4-requirments
Software Engineering Lec 4-requirments
 
Software Engineering Lec 3-project managment
Software Engineering Lec 3-project managmentSoftware Engineering Lec 3-project managment
Software Engineering Lec 3-project managment
 
Software Engineering Lec 2
Software Engineering Lec 2Software Engineering Lec 2
Software Engineering Lec 2
 
Software Engineering Lec 1-introduction
Software Engineering Lec 1-introductionSoftware Engineering Lec 1-introduction
Software Engineering Lec 1-introduction
 
Lec 6-
Lec 6-Lec 6-
Lec 6-
 
presentation skill
presentation skillpresentation skill
presentation skill
 
Lec 4
Lec 4Lec 4
Lec 4
 
Lec 3
Lec 3Lec 3
Lec 3
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

Computer network coe351- part2- final

  • 1. Course code: COE351 Course title : Computer Networks PART: 2 Prof. Taymoor Mohamed Nazmy Dept. of computer science, faculty of computer science, Ain Shams uni. Ex-vice dean of post graduate studies and research Cairo, Egypt 1
  • 2. Introduction to Network protocols, and the internet protocols 2
  • 3. Communications Protocol • All communications between devices require that the devices agree on the format of the data. The set of rules defining a format is called a protocol. At the very least, a communications protocol functions must define the following: • rate of transmission (in baud or bps), addressing, Ordered delivery • whether transmission is to be synchronous or asynchronous , • whether data is to be transmitted in half-duplex or full-duplex mode • In addition, protocols can include sophisticated techniques • for detecting and recovering from transmission errors • and for encoding and decoding data. • A list of the protocols used by a certain system, one protocol per layer, is called a protocol stack
  • 4. Network protocols • The following articles contain lists of network protocols • WIFI/WIMAX Protocols • Bluetooth protocol • Fibre Channel network protocols • Internet Protocol Suite or TCP/IP model or TCP/IP stack • Routing protocols • SSH Secure Shell • SMB Server Message Block, one version of which was also known as CIFS (Common Internet File System) • FTP File Transfer Protocol • SMTP Simple Mail Transfer Protocol • TCP Transmission Control Protocol • Telnet Teletype Network 4
  • 5. • HTTP Hyper Text Transfer Protocol • HTTPs Secure Hyper Text Transfer Protocol • POP Post Office Protocol • MTP Media Transfer Protocol • SFTP Secure File Transfer Protocol • SSL Secure Socket Layer • TLS Transport Layer Security • E6 Ethernet globalization protocols • NTP Network time protocol • PPP Point to Point Protocol • NNTP Network News Transfer Protocol • IMAP Internet Message Access Protocol • Bitcoin Protocol Protocol for Bitcoin transactions and transfers on the web 5
  • 6. Request for Comments (RFC) • Memos in the Requests for Comments (RFC) document series contain technical and organizational notes about the Internet. They cover many aspects of computer networking, including protocols, procedures, programs, and concepts, as well as meeting notes, opinions. . Each protocol has its own RFC number, it may contain a huge amount of information about this protocol. • The index of RFC can be found blew • https://www.rfc-editor.org/rfc-index.html • RFC 2616 for HTTP protocol can be found in • https://tools.ietf.org/html/rfc2616
  • 7. 7 Understanding the OSI Model • In an effort to identify and standardize all the levels of communication needed in networking, ISO developed a networking model called the Open Systems Interconnection (OSI) reference model. • The OSI reference model provides a universally accepted reference illustrating how data is transmitted on a network or between two or more networked devices.
  • 8. 8 The OSI model layers 8
  • 9. TCP/IP Protocol Suite 9 TCP/IP PROTOCOL SUITE The TCP/IP protocol suite was developed prior to the OSI model. Therefore, the layers in the TCP/IP protocol suite do not match exactly with those in the OSI model. The original TCP/IP protocol suite was defined as four software layers built upon the hardware. Today, however, TCP/IP is thought of as a five-layer model with the layers named similarly to the ones in the OSI model. 9
  • 10. TCP/IP Model Application Layer Application programs using the network Transport Layer (TCP/UDP) Management of end-to-end message transmission, error detection and error correction Network Layer (IP) Handling of datagrams : routing and congestion Data Link Layer Management of cost effective and reliable data delivery, access to physical networks Physical Layer Physical Media 10
  • 11. 11
  • 12. The TCP/IP model with different name for layer 3 and 4 and no physical layer showed in
  • 13. How TCP/IP talk to each other • TCP/IP has four layers. Programs talk to the Application layer. On the Application layer you will find Application protocols such as SMTP (for e-mail), FTP (for file transfer) and HTTP (for web browsing). • Each kind of program talks to a different Application protocol, depending on the program purpose.
  • 14. • After processing the program request, the protocol on the Application layer will talk to another protocol from the Transport layer, usually TCP. • This layer is in charge of getting data sent by the upper layer, dividing them into packets and sending them to the layer below, Internet. • Also, during data reception, this layer is in charge of putting the packets received from the network in order (because they can be received out-of- order) and also checking if the contents of the packets are intact. How TCP/IP talk to each other
  • 15. • On the network layer we have the IP (Internet Protocol), which gets the packets received from the Transport layer and adds virtual address information, i.e., adds the address of the computer that is sending data and the address of the computer that will receive this data. • These virtual addresses are called IP addresses. Then the packet is sent to the lower layer, link layer. On this layer packets are called datagrams. How TCP/IP talk to each other
  • 16. • The link layer will get the packets sent by network and send them over the network (or receive them from the network, if the computer is receiving data). How TCP/IP talk to each other
  • 17. Data encapsulation - During a transmission, data crosses each one of the layers at the source machine. At each layer, a piece of information is added to the data packet, this is the header, a collection of information which guarantees transmission. At the destination machine, when passing through each layer, the header is read, and then deleted. So, upon its receipt, the message is in its original state. At each level, the data packet changes aspect, because a header is added to it, so the designations change according to the layers:  The data packet is called a message at Application Layer  The message is then encapsulated in the form of a segment in the Transport Layer  Once the segment is encapsulated in the Internet Layer it takes the name of datagram  Finally, we talk about a frame at the Link Layer Data Encapsulation
  • 18. 18 Data Encapsulation • As data is moving down the protocol stack, each protocol is adding layer-specific control information HTTP TCP IP Ethernet User data User dataHTTP Header TCP Header TCP HeaderIP Header TCP HeaderIP Header Ethernet Header Ethernet Trailer IP datagram TCP segment Ethernet frame User dataHTTP Header User dataHTTP Header User dataHTTP Header
  • 19. 19 Protocol Data Units (PDU) • User data is passed from layer to layer • Control information is added/removed to/from user data at each layer —Header (and sometimes trailer) —each layer has a different header/trailer • Data + header + trailer = PDU (Protocol Data Unit) —This is basically what we call packet —each layer has a different PDU 19
  • 20. 20 Assignment of Protocols to Layers Network Layer Routing Protocols PIM OSPF RIP Application Layer Data Link Layer IP ARP Ethernet Network Interface Transport Layer TCP UDP SNMPFTP DNSHTTP ICMP IGMP ping application Telnet DHCP
  • 21. Layers Addresses 21 21 Address Example Software Example Address Application Layer Web browser ike.ba.ttu.edu Transport Layer HTTP (Port address) 80 Network Layer TCP/IP (IP address) 129.118.49.189 Data Link Layer Ethernet MAC address 00-A0-C9-96-1D-90 IP MAC
  • 22. 22 • A user on host argon.tcpip-lab.edu (“Argon”) makes a web access to URL http://Neon. tcpip-lab.edu/index.html. • • What actually happens in the network? Sending data scenario over the TCP/IP
  • 23. 23 HTTP Request and HTTP response • Web browser runs an HTTP client program • Web server runs an HTTP server program • HTTP client sends an HTTP request to HTTP server • HTTP server responds with HTTP response HTTP client Argon HTTP server Neon HTTP request HTTP response
  • 24. 24 From HTTP to TCP • To send request, HTTP client program establishes an TCP connection to the HTTP server Neon. • The HTTP server at Neon has a TCP server running HTTP client TCP client Argon HTTP server TCP server Neon HTTP request / HTTP response TCP connection
  • 25. 25 Resolving hostnames and port numbers • Since TCP does not work with hostnames and also would not know how to find the HTTP server program at Neon, two things must happen: 1. The name “neon.tcpip-lab.edu” must be translated into a 32-bit IP address. 2. The HTTP server at Neon must be identified by a 16-bit port number.
  • 26. 26 Translating a hostname into an IP address • The translation of the hostname neon.tcpip-lab.edu into an IP address is done via a database lookup • The distributed database used is called the Domain Name System (DNS) • All machines on the Internet have an IP address: argon.tcpip-lab.edu 128.143.137.144 neon.tcpip-lab.edu 128.143.71.21 HTTP client DNS Server argon.tcpip-lab.edu 128.143.136.15 neon.tcpip-lab.edu 128.143.71.21
  • 27. 27 Finding the port number • Note: Most services on the Internet are reachable via well-known ports. E.g. All HTTP servers on the Internet can be reached at port number “80”. • So: Argon simply knows the port number of the HTTP server at a remote machine. • The well-known port numbers of some of the most popular services are: ftp 21 finger 79 telnet 23 http 80 smtp 25 nntp 119
  • 28. 28 Requesting a TCP Connection • The HTTP client at argon.tcpip-lab.edu requests the TCP client to establish a connection to port 80 of the machine with address 128.141.71.21 HTTP client TCP client argon.tcpip-lab.edu Establish a TCP connection to port 80 of 128.143.71.21
  • 29. 29 Invoking the IP Protocol • The TCP client at Argon sends a request to establish a connection to port 80 at Neon • This is done by asking its local IP module to send an IP datagram to 128.143.71.21 • (The data portion of the IP datagram contains the request to open a connection) TCP client argon.tcpip-lab.edu IP Send an IP datagram to 128.143.71.21
  • 30. 30 Sending the IP datagram to an IP router • Argon (128.143.137.144) can deliver the IP datagram directly to Neon (128.143.71.21), only if it is on the same local network (“subnet”) • But Argon and Neon are not on the same local network • So, Argon sends the IP datagram to its default gateway • The default gateway is an IP router • The default gateway for Argon is Router137.tcpip- lab.edu (128.143.137.1).
  • 31. 31 The route from Argon to Neon • Note that the gateway has a different name for each of its interfaces.
  • 32. 32 Finding the MAC address of the gateway • To send an IP datagram to Router137, Argon puts the IP datagram in an Ethernet frame, and transmits the frame. • However, Ethernet uses different addresses, so-called Media Access Control (MAC) addresses (also called: physical address, hardware address) • Therefore, Argon must first translate the IP address 128.143.137.1 into a MAC address. • The translation of addressed is performed via the Address Resolution Protocol (ARP)
  • 34. 34 Invoking the device driver • The IP module at Argon, tells its Ethernet device driver to send an Ethernet frame to address 00:e0:f9:23:a8:20 argon.tcpip-lab.edu IP module Ethernet Send an Ethernet frame to 00:e0:f9:23:a8:20
  • 35. 35 Sending an Ethernet frame • The Ethernet device driver of Argon sends the Ethernet frame to the Ethernet network interface card (NIC) • The NIC sends the frame onto the wire
  • 36. 36 Forwarding the IP datagram • The IP router receives the Ethernet frame at interface 128.143.137.1, recovers the IP datagram and determines that the IP datagram should be forwarded to the interface with name 128.143.71.1 • The IP router determines that it can deliver the IP datagram directly
  • 37. 37 Another lookup of a MAC address • The router needs to find the MAC address of Neon. • Again, ARP is invoked, to translate the IP address of Neon (128.143.71.21) into the MAC address of neon (00:20:af:03:98:28).
  • 38. 38 Invoking the device driver at the router • The IP protocol at Router71, tells its Ethernet device driver to send an Ethernet frame to address 00:20:af:03:98:28 router71.tcpip-lab.edu IP module Ethernet Send a frame to 00:20:af:03:98:28
  • 39. 39 Sending another Ethernet frame • The Ethernet device driver of Router71 sends the Ethernet frame to the Ethernet NIC, which transmits the frame onto the wire.
  • 40. 40 Data has arrived at Neon • Neon receives the Ethernet frame • The payload of the Ethernet frame is an IP datagram which is passed to the IP protocol. • The payload of the IP datagram is a TCP segment, which is passed to the TCP server • Note: Since the TCP segment is a connection request (SYN), the TCP protocol does not pass data to the HTTP program for this packet. Instead, the TCP protocol at neon will respond with a SYN segment to Argon. HTTP server Neon.cerf.edu TCP server IP module Ethernet
  • 41. 41 Layers in the Example HTTP TCP IP argon.tcpip- lab.edu 128.143.137.144 Ethernet Ethernet Ethernet IP HTTP TCP IP neon.tcpip-lab.edu 128.143.71.21 Ethernet router71.tcpip- lab.edu 128.143.137.1 00:e0:f9:23:a8:20 router137.tcpip- lab.edu 128.143.71.1 Send HTTP Request to neon Establish a connection to 128.143.71.21 at port 80 Open TCP connection to 128.143.71.21 port 80 Send a datagram (which contains a connection request) to 128.143.71.21 Send IP datagram to 128.143.71.21 Send the datagram to 128.143.137.1 Send Ethernet frame to 00:e0:f9:23:a8:20 Send Ethernet frame to 00:20:af:03:98:28 Send IP data-gram to 128.143.71.21 Send the datagram to 128.143.7.21 Frame is an IP datagram Frame is an IP datagram IP datagram is a TCP segment for port 80
  • 43. Application layer • This layer makes the communication between programs and the transport protocols. There are several different protocols that work on the Application layer. • The most known are HTTP (HyperText Transfer Protocol), SMTP (Simple Mail Transfer Protocol), FTP (File Transfer Protocol), SNMP (Simple Network Management Protocol), DNS (Domain Name System) and Telnet. You may have already seen these names before.
  • 44. • The Application layer talks to the Transport layer through a port. Ports are numbered and standard applications always use the same port. • For example, SMTP protocol always use port 25, HTTP protocol always use port 80 and FTP protocol always use ports 20 (for data transmission) and 21 (for control).
  • 45. Common Port Numbers  FTP – 20-21 Telnet – 23 SMTP – 25 DNS – 53 (Both TCP & UDP) HTTP – 80 DHCP – 67 & 68 POP – 110 A port is an endpoint of communication in an operating system, Specific port numbers are often used to identify specific services.
  • 46.
  • 47.
  • 48. Application layer Protocols  FTP – allows the download/upload of files between a client/server  DHCP – assigns IP addresses, subnet masks, default gateways, DNS servers, etcs. To users as they login the network  DNS – Matches domain names with IP addresses  SMTP & POP3 – used to send email messages from clients to servers over the internet  Telnet – allows users to login to a host from a remote location and take control as if they were sitting at the machine (virtual connection)  HTTP – Used to transfer data between clients/servers using a web browser 48
  • 49. 2-49 Some network apps  e-mail  web  text messaging  remote login  P2P file sharing  multi-user network games  streaming stored video (YouTube, Hulu, Netflix)  voice over IP (e.g., Skype)  real-time video conferencing  social networking  search  …  … 49
  • 50. 2-50 Creating a network app write programs that: • run on (different) end systems • communicate over network • e.g., web server software communicates with browser software no need to write software for network-core devices • network-core devices do not run user applications • applications on end systems allows for rapid app development, propagation application transport network data link physical application transport network data link physical application transport network data link physical
  • 51. 51 Client-server paradigm Typical network app has two pieces: client and server application transport network data link physical application transport network data link physical Client:  initiates contact with server (“speaks first”)  typically requests service from server,  for Web, client is implemented in browser; for e-mail, in mail reader Server:  provides requested service to client  e.g., Web server sends requested Web page, mail server delivers e- mail request reply
  • 52. 52 Some Web terms • Web page: – consists of “objects” – addressed by a URL • Most Web pages consist of: – base HTML page, and – several referenced objects. • URL has two components: host name and path name: • User agent for Web is called a browser: – MS Internet Explorer – Netscape Communicator • Server for Web is called Web • server: – Apache (public domain) – MS Internet Information Server
  • 53. 2-53 Web and HTTP First, a review… • web page consists of objects • object can be HTML file, JPEG image, Java applet, audio file,… • web page consists of base HTML-file which includes several referenced objects • each object is addressable by a URL, e.g., www.someschool.edu/someDept/pic.gif host name path name
  • 54. 54 Web Caches (proxy server) • user sets browser: Web accesses via web cache • client sends all http requests to web cache – if object at web cache, web cache immediately returns object in http response – else requests object from origin server, then returns http response to client Goal: satisfy client request without involving origin server client Proxy server client origin server origin server
  • 55. Domain Name System (DNS) • The Domain Name System (DNS) is a hierarchical decentralized naming system for computers, services, or other resources connected to the Internet or a private network. • It associates various information with domain names assigned to each of the participating entities. • Most prominently, it translates more readily memorized domain names to the numerical IP addresses needed for locating and identifying computer services and devices with the underlying network protocols.
  • 56. How DNS work  , an application program:  Calls a library procedure called the resolver, passing it the name as a parameter  The resolver sends a UDP packet to a local DNS server  DNS server looks up the name and returns the IP address to the resolver  Resolver returns it to the application  Armed with the IP address, the program can then establish a TCP connection with the destination or send it UDP packets 56
  • 57. DSN Services and Protocol DNS Servers resolve names to IP addresses. It would be difficult to remember the IP address of every website we like to visit, but we can remember names. 57
  • 58. 15-58 Domain Name System • The very last section of the domain is called its top- level domain (TLD) name
  • 59.
  • 60. 60 FTP: the file transfer protocol • transfer file to/from remote host • client/server model – client: side that initiates transfer (either to/from remote) – server: remote host file transfer FTP server FTP user interface FTP client local file system remote file system user at host
  • 61. 61 FTP: separate control, data connections • ftp client contacts ftp server at port 21, specifying TCP as transport protocol • two parallel TCP connections opened: – control: exchange commands, responses between client, server. “out of band control” – data: file data to/from server FTP client FTP server TCP control connection port 21 TCP data connection port 20
  • 62. E-mail services and SMTP/POP protocols • E-mail is the most popular network service. • E-mail client (when people compose e-mail) is called Mail User Agent (MUA) • MUA allows messages to be sent/retrieved to and from your mailbox • Requires several applications and services – POP or POP3 – deliver email from server to client (incoming messages) – SMTP – handles outbound messages from clients 62
  • 63. E-mail services and SMTP/POP protocols • What do servers require? 1) Must be running SMTP! 2) Also operates 1) Mail Transfer Agent (MTA) – used to forward email 1) Receives email from the clients MUA 2) Uses SMTP to route email between SERVERS! 3) Passes email to the MDA for final delivery 2) Mail Delivery Agent (MDA) – receives messages from MUA or from the MTA on another server 3) For two e-mail servers to talk – MUST run SMTP and MTA in order to transfer mail between the 2 servers! 63
  • 64. E-mail services and SMTP/POP protocols 64
  • 65. DHCP • The Dynamic Host Configuration Protocol (DHCP) is a standardized network protocol. The DHCP is controlled by a DHCP server that dynamically distributes network configuration parameters, such as IP addresses, for interfaces and services. • A router or a residential gateway can be enabled to act as a DHCP server. 65
  • 66. • A DHCP server enables computers to request IP addresses and networking parameters automatically, reducing the need for a network administrator or a user to configure these settings manually. • In the absence of a DHCP server, each computer or other device on the network needs to be manually assigned to an IP address.
  • 67. Telnet • TELNET is an abbreviation for TErminaL NETwork. It is the standard TCP/IP protocol for virtual terminal service as proposed by ISO. • TELNET enables the establishment of a connection to a remote system in such a way that the local terminal appears to be a terminal at the remote system • Uses a client/server model to define a standard way in which to interact with a remote system. • The telnet protocol is the basis for many protocols – FTP, HTTP, SMTP. – TELNET is a protocol that provides “a general, bi-directional, communications facility. 67
  • 70. Purpose of Transport Layer 1) Tracking the individual communication between applications on the source and destination hosts: Any host may have multiple applications that are communicating across the network. Each of these applications will be communicating with one or more applications on remote hosts. It is the responsibility of the Transport layer to maintain the multiple communication streams between these applications.
  • 71. 2) Segmenting data and managing each piece: As each application creates a stream data to be sent to a remote application, this data must be prepared to be sent across the media in manageable pieces. The Transport layer protocols describe services that segment this data from the Application layer. This includes the encapsulation required on each piece of data. Each piece of application data requires headers to be added at the Transport layer to indicate to which communication it is associated.
  • 72.
  • 73. 3)Reassembling the segments into streams of application data: At the receiving host, each piece of data may be directed to the appropriate application. Additionally, these individual pieces of data must also be reconstructed into a complete data stream that is useful to the Application layer.
  • 74.
  • 75. • The protocols at the Transport layer describe the how the Transport layer header information is used to reassemble the data pieces into streams to be passed to the Application layer.
  • 76. 4) Identifying the different applications: In order to pass data streams to the proper applications, the Transport layer must identify the target application. To accomplish this, the Transport layer assigns an application an identifier. The TCP/IP protocols call this identifier a port number. Each software process that needs to access the network is assigned a port number unique in that host. This port number is used in the transport layer header to indicate to which application that piece of data is associated.
  • 77. Reliable Communication In networking terms, reliability means ensuring that each piece of data that the source sends arrives at the destination. At the Transport layer the three basic operations of reliability are: a) tracking transmitted data b) acknowledging received data c) retransmitting any unacknowledged data This requires the processes of Transport layer of the source to keep track of all the data pieces of each conversation and the retransmit any of data that did were not acknowledged by the destination.
  • 78. The Transport layer of the receiving host must also track the data as it is received and acknowledge the receipt of the data. These reliability processes place additional overhead on the network resources due to the acknowledgement, tracking, and retransmission. To support these reliability operations, more control data is exchanged between the sending and receiving hosts. This control information is contained in the Transport Layer header.
  • 79. Determining the Need for Reliability Applications, such as databases, web pages, and e-mail, require that all of the sent data arrive at the destination in its original condition, in order for the data to be useful. Any missing data could cause a corrupt communication that is either incomplete or unreadable. Therefore, these applications are designed to use a Transport layer protocol that implements reliability. The additional network overhead is considered to be required for these applications.
  • 80. • Other applications are more tolerant of the loss of small amounts of data. • For example, if one or two segments of a video stream fail to arrive, it would only create a momentary disruption in the stream. • This may appear as distortion in the image but may not even be noticeable to the user.
  • 81. Ports * The two protocols TCP and UDP based services keep track of the various applications that are communicating. To differentiate the segments and datagrams for each application, both TCP and UDP have header fields that can uniquely identify these applications. These unique identifiers are the port numbers. * In the header of each segment or datagram, there is a source and destination port. The source port number is the number for this communication associated with the originating application on the local host. The destination port number is the number for this communication associated with the destination application on the remote host.
  • 82. • * Port numbers are assigned in various ways, depending on whether the message is a request or a response. • While server processes have static port numbers assigned to them, clients dynamically chooses a port number for each conversation. • * The combination between IP address and port number is called socket and it’s unique connection.
  • 83.
  • 84. TCP and UDP Protocols The two most common Transport layer protocols of TCP/IP protocol suite are Transmission Control Protocol (TCP) and User Datagram Protocol (UDP). Both protocols manage the communication of multiple applications. The differences between the two are the specific functions that each protocol implements. User Datagram Protocol (UDP) UDP is a simple, connectionless protocol, described in RFC 768. It has the advantage of providing for low overhead data delivery. The pieces of communication in UDP are called datagrams. These datagrams are sent as "best effort" by this Transport layer protocol. Applications that use UDP include: Video Streaming Voice over IP (VoIP)
  • 85. UDP Protocol UDP is a simple protocol that provides the basic Transport layer functions. It much lower overhead than TCP, since it is not connection-oriented and does not provide the sophisticated retransmission, sequencing, and flow control mechanisms. This does not mean that applications that use UDP are always unreliable. It simply means that these functions are not provided by the Transport layer protocol and must be implemented elsewhere if required. Although the total amount of UDP traffic found on a typical network is often relatively low, key Application layer protocols that use UDP include: Domain Name System (DNS) Simple Network Management Protocol (SNMP) Dynamic Host Configuration Protocol (DHCP) Routing Information Protocol (RIP) Trivial File Transfer Protocol (TFTP)
  • 86. • Some applications, such as online games or VoIP, can tolerate some loss of some data. If these applications used TCP, they may experience large delays while TCP detects data loss and retransmits data. • These delays would be more detrimental to the application than small data losses. Some applications, such as DNS, will simply retry the request if they do not receive a response, and therefore they do not need TCP to guarantee the message delivery. • The low overhead of UDP makes it very desirable for such applications.
  • 87. UDP Datagram Structure * Source port: This field identifies the sending port when meaningful and should be assumed to be the port to reply to if needed. If not used, then it should be zero. * Destination port: This field identifies the destination port and is required. * Length: A 16-bit field that specifies the length in bytes of the entire datagram: header and data. The minimum length is 8 bytes since that's the length of the header. * Checksum: The 16-bit checksum field is used for error-checking of the header and data.
  • 88. Transmission Control Protocol (TCP) • TCP is a connection-oriented protocol, described in Request for Comments (RFC 793). • TCP incurs additional overhead to gain functions. Additional functions specified by TCP are the same order delivery, reliable delivery, and flow control. • Each TCP segment has 20 bytes of overhead in the header encapsulating the Application layer data, whereas each UDP segment only has 8 bytes of overhead. • Applications that use TCP are: • Web Browsers • E-mail • File Transfers
  • 89. Transmition Control Protocol (TCP) The reliability of TCP communication is performed using connection- oriented sessions. Before a host using TCP sends data to another host, the Transport layer initiates a process to create a connection with the destination. * Establishes a session between source host and source destination (this ensures that each host is prepared and aware for the connection). * The destination host sends acknowledgements to the source for the segments that it receives. * As the source receives an acknowledgement, it knows that the data has been successfully delivered and can quit tracking that data.
  • 90. • * If the source does not receive an acknowledgement within a predetermined amount of time, it retransmits that data to the destination. • * The establishment of the sessions creates overhead in the form of additional segments being exchanged. • * There is also additional overhead on the individual hosts created by the necessity to keep track of which segments are awaiting acknowledgement and by the retransmission process.
  • 91. 91 TCP Format IP header TCP header TCP data Sequence number (32 bits) DATA 20 bytes 20 bytes 0 15 16 31 Source Port Number Destination Port Number Acknowledgement number (32 bits) window size header length 0 Flags Options (if any) TCP checksum urgent pointer 20bytes TCP segments have a 20 byte header with >= 0 bytes of data.
  • 92. TCP Segment Structure * Source port (16 bits) – identifies the sending port * Destination port (16 bits) – identifies the receiving port * Sequence number (32 bits) – has a dual role • If the SYN flag is set, then this is the initial sequence number. The sequence number of the actual first data byte (and the acknowledged number in the corresponding ACK) will then be this sequence number plus 1. * If the SYN flag is clear, then this is the sequence number of the first data byte * Acknowledgment number (32 bits) * Data offset (4 bits) – specifies the size of the TCP header in 32-bit words * Reserved (4 bits) – for future use and should be set to zero • Flags (8 bits) (aka Control bits) – contains 8 1-bit flags * Window (16 bits) – the size of the receive window, which specifies the number of bytes that the receiver is currently willing to receive. * Checksum (16 bits) – The 16-bit checksum field is used for error-checking of the header and data * Urgent pointer (16 bits) – if the URG flag is set, then this 16-bit field is an offset from the sequence number indicating the last urgent data byte.
  • 93. 93 Services provided by Internet transport protocols TCP service:  connection-oriented: setup required between client, server  reliable transport between sending and receiving process  flow control: sender won’t overwhelm receiver  congestion control: adjust sender when network overloaded  does not providing: minimum bandwidth guarantees UDP service:  unreliable data transfer between sending and receiving process  does not provide: connection setup, reliability, flow control, congestion control, or bandwidth guarantee 93
  • 94. Connection Termination Reliable, In-Order Data Exchange Connection Establishment Typical TCP Transaction Client Server timetime  when client creates socket:  client TCP establishes connection to server TCP.  A TCP Transaction consists of 3 Phases 1. Connection Establishment  Handshaking between client and server 2. Reliable, In-Order Data Exchange  Recover any lost data through retransmissions and ACKs 3. Connection Termination  Closing the connection
  • 95. Connection Establishment (cont) Host A Host B time Three-way handshake Three way handshake:  Host A sends a TCP SYNchronize packet to Host B  Host B receives A's SYN  Host B sends a SYNchronize- ACKnowledgement  Host A receives B's SYN+ACK  Host A sends ACKnowledge  Host B receives ACK.  TCP socket connection is ESTABLISHED time Connection request host ACKs and selects its own initial seq # host ACKs
  • 96. TCP Connection Termination Closing a connection: client closes socket: clientSocket.close(); Step 1: client end system sends TCP FIN control segment to server Step 2: server receives FIN, replies with ACK. Server might send some buffered before closing the connection. Server then sends FIN and moves to Closing state. client server close Data write closed timedwait close
  • 97. TCP Connection Termination Step 3: client receives FIN, replies with ACK.  Enters “timed wait” - will respond with ACK to received FINs Step 4: server, receives ACK. Connection closed.  Why wait before closing the connection?  If the connection were allowed to move to CLOSED state, then another pair of application processes might come along and open the same connection (use the same port #s) and a delayed FIN from an earlier incarnation would terminate the connection. client server closing closing closedtimedwait closed
  • 98. Flow control • Flow control is a function for the control of the data flow 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.
  • 99. • However, one of the services of the network level is to prevent congestion. Thus the network level also uses flow control to restrict the flow of network protocol data units . • Thus flow control becomes a much more complex issue at the transport layer than at lower levels like the datalink level.
  • 100. TCP Flow Control Flow control assists the reliability of TCP transmission by adjusting the effective rate of data flow between the two services in the session. When the source is informed that the specified amount of data in the segments is received, it can continue sending more data for this session. This Window Size field in the TCP header specifies the amount of data that can be transmitted before an acknowledgement must be received. The initial window size is determined during the session startup via the three-way handshake.
  • 101. • TCP feedback mechanism adjusts the effective rate of data transmission to the maximum flow that the network and destination device can support without loss. • TCP attempts to manage the rate of transmission so that all data will be received and retransmissions will be minimized.
  • 102.
  • 103. Reducing Window Size * Another way to control the data flow is to use dynamic window sizes. When network resources are constrained, TCP can reduce the window size to require that received segments be acknowledged more frequently. This effectively slows down the rate of transmission because the source waits for data to be acknowledged more frequently. * The TCP receiving host sends the window size value to the sending TCP to indicate the number of bytes that it is prepared to receive as a part of this session.
  • 104. • If the destination needs to slow down the rate of communication because of limited buffer memory, it can send a smaller window size value to the source as part of an acknowledgement.
  • 105.
  • 106. 24.106 CONGESTION Congestion in a network may occur if the load on the network—the number of packets sent to the network— is greater than the capacity of the network—the number of packets a network can handle. Congestion control refers to the mechanisms and techniques to control the congestion and keep the load below the capacity. 106
  • 107. 24.107 CONGESTION CONTROL Congestion control refers to techniques and mechanisms that can either prevent congestion, before it happens, or remove congestion, after it has happened. In general, we can divide congestion control mechanisms into two broad categories: open- loop congestion control (prevention) and closed- loop congestion control (removal). 107
  • 108. 108 Congestion Control vs. Flow Control • They are highly related to each other. The difference is subtle. • Congestions control is a global issue, involving all hosts, routers, and other factors • Flow control relates to the point-to-point traffic • between a given sender and a given receiver, making sure a faster sender won’t swamp a slow receiver.
  • 109. 109 Congestion Control Causes • Congestion is a problem when too many packets are present in the subnet, performance degrades • Congestions can be brought on by several factors: – All of a sudden, streams of packets arrive on multiple input lines and all of them need the same output line, a queue is built up. Allocating more memory may help to a point but with infinite memory, congestion gets worse because packets are timed out. – Slow processors make queue to be built up even though there are enough bandwidth. – Low-bandwidth also causes congestion.
  • 110. • Network congestion in data networking quality of service that occurs when a network node is carrying more data than it can handle. • A consequence of congestion is that an incremental increase in offered load leads either only to a small increase or even a decrease in network throughput. • Network protocols that use aggressive retransmissions to compensate for packet loss due to congestion can increase congestion, even after the initial load has been reduced to a level that would not normally have induced network congestion. • Such networks exhibit two stable states under the same level of load. The stable state with low throughput is known as congestive collapse.
  • 111. • Networks use congestion control and congestion avoidance techniques to try to avoid collapse. These include: exponential backoff in protocols such as CSMA/CA in 802.11 and the original Ethernet, window reduction in TCP, and fair queueing in devices such as routers. • Another method is to implement priority schemes, transmitting some packets with higher priority than others. • A third avoidance method is the explicit allocation of network resources to specific flows through the use of admission
  • 112. 112 Solutions for Congestion • The presence of congestion means that the load is greater than the resources can handle • Two solutions – Increase the resource: increase the bandwidth, Split the traffic over multiple routes, Put spare routers on-line – Decrease the traffic: deny service to new users (hire- freezing), degrade service to some/all users (reduce salary), drop some users (lay off)
  • 113. 113 Congestion Prevention Policies Policies that affect congestion. 5-26
  • 115. 115
  • 116. Multiplexing and demultiplexing • Multiplexing is the process in which multiple Data Streams, coming from different Sources, are combined and Transmitted over a Single Data Channel or Data Stream. • In Electronic Communications, the two basic forms of Multiplexing are Time Division Multiplexing (TDM) and Frequency Division Multiplexing (FDM).
  • 117. • Multiplexing is done by an equipment called Multiplexer (MUX). It is placed at the Transmitting End of the communication link. • At the Receiving End, the Composite Signal is separated by an equipment called Demultiplexer (DEMUX). Demultiplexer performs the reverse process of Multiplexing and routes the separated signals to their corresponding Receivers or Destinations. • The Transport layer in TCP/IP model, • provides multiplexing of several data.
  • 119. Question • Which address is used in an internet employing the TCP/IP protocols? a) physical address and logical address b) port address c) specific address d) all of the mentioned. • . TCP/IP model was developed _____ the OSI model. a) prior to b) after c) simultaneous to d) none of the mentioned. 119
  • 120. • Which address identifies a process on a host? a) physical address b) logical address c) port address d) specific address. • Which layer provides the services to user? a) application layer b) session layer c) presentation layer d) none of the mentioned. 120
  • 121. • Transmission data rate is decided by a) network layer b) physical layer c) data link layer d) transport layer. • The 4 byte IP address consists of a) network address b) host address c) both (a) and (b) d) none of the mentioned. 121
  • 122. • The network layer protocol of internet is a) ethernet b) internet protocol c) hypertext transfer protocol d) none of the mentioned. • Transport layer aggregates data from different applications into a single stream before passing it to a) network layer b) data link layer c) application layer d) physical layer 122
  • 123. • Which one of the following is a transport layer protocol used in internet? a) TCP b) UDP c) both (a) and (b) d) none of the mentioned. • . The ____ translates internet domain and host names to IP address. a) domain name system b) routing information protocol c) network time protocol d) internet relay chat. 123
  • 124. • When displaying a web page, the application layer uses the a) HTTP protocol b) FTP protocol c) SMTP protocol d) none of the mentioned. 124