Download - Lecture 12 - TCP Overview
-
8/7/2019 Lecture 12 - TCP Overview
1/12
CS65-Computer Networks Dept. of EEE
S.Muralidharan 1
TRANSPORT LAYER
Duties
The transport layer is responsible for processThe transport layer is responsible for process--toto--processprocessdeliverydeliverythe delivery of a packet, part of a message, fromthe delivery of a packet, part of a message, from
one process to another.one process to another.
2
Example 1
3
Example 2
port addresses
physical address
network addresses
4
-
8/7/2019 Lecture 12 - TCP Overview
2/12
-
8/7/2019 Lecture 12 - TCP Overview
3/12
CS65-Computer Networks Dept. of EEE
S.Muralidharan 3
Service Access Point contd
To implement process-to-process communication, client-server paradigm is easier.
Both client and server process have the same name. For eg. To get the day and time from remote machine, we need a
Daytime client process running on the local host and a Daytimeserver process running on a remote machine.
Like MAC address at Data link layer, IP address at Networklayer , Transport layer uses Port number to identify aprocess.
In the internet model, port numbers are 16-bit integers
between 0 & 65,535. The client program defines a port number chosen randomly
by the transport layer protocol running on it. This is calledEphemeral Port Number
9
Service Access Point contd
Client and server will interact to using special packet toknow the port address, they want to communicate. But
requires more overhead.
To avoid this, internet uses universal port numbers for
servers called well-known port numbers.
Every client process knows the well-known port number of
corresponding server process.
Shortlived/Briefport number
well-knownport number
10
Port Number
Internet Assigned Number Authority (IANA) has dividedports into three ranges : Well known, Registered and Dynamic.
Well-known : Ranges between 0 and 1023; assigned and controlledby IANA
Registered : Ranges between 1024 and 49151; not assigned andcontrolled by IANA but can be registered with IANA to preventduplication.
Dynamic : Ranges between 49152 and 65635; neither controlled norregistered; can be used by any process. These are aphemeral ports.
11
IP addressing Vs Port addressing
IP defines the host to be
selected among the different
hosts in the world.
Port number defines one ofthe processes on this
particular host.
12
-
8/7/2019 Lecture 12 - TCP Overview
4/12
CS65-Computer Networks Dept. of EEE
S.Muralidharan 4
Socket Address
This is the combination of IP address and port number
13
Multiplexing & Demultiplexing
Transport entity perform multiplexing function with respect tothe network services that it uses.
14
Multiplexing & Demultiplexing .Contd
Upward multiplexingUpward multiplexing single transport layer share multiple
higher layer
Downward multiplexingDownward multiplexing single transport layer share
multiple lower layer
15
Connectionless & Connection Oriented
Connectionless service :Connectionless service :
Packets are sent from one party to another with no need forconnection establishment and connection release.
Packets are not numbered , they may be delayed or lost or arrive
out of sequence.
There is no acknowledgement Connection oriented service :Connection oriented service :
Connection is established before transferring data and at the endconnection is released.
16
-
8/7/2019 Lecture 12 - TCP Overview
5/12
CS65-Computer Networks Dept. of EEE
S.Muralidharan 5
Reliable and Unreliable
Transport layer service can be reliable or unreliable. If thehigher layer (application layer) needs reliability, we use areliable transport layer by employing flow and error control.
Error is defined as a lost or duplicated network protocol dataunit.
If the error is caught and corrected by the network service ina fashion that is transparent to the transport entity, nodamage is done.
If the network service detects an error, cannot recover, andsignals the transport entities, this is known as a signaled
failure.
Those which are not corrected and for which the transportentity is not notified is called residual error.
17
Reliable and Unreliable contd
ISO has defined three types of network services : Type A : network connections with acceptable residual error rate
and acceptable rate of signaled failures. (Reliable)
Type B : network connections with acceptable residual error rate
but unacceptable rate of signaled failure. (Unreliable)
Type C : network connections with residual error rate not
acceptable to the transport service user. (Unreliable)
18
Position of UDP, TCP, and SCTP in TCP/IP suite
User Datagram Protocol (UDP) is connectionless and unreliable ;
Transmission Control Protocol (TCP) and Stream Control Transmission
Protocol (SCTP) are connection oriented and reliable.
19
Transmission Control Protocol (TCP)
TCP is a connectionTCP is a connection--oriented protocoloriented protocol
It creates a virtual connection between two TCPs to send
data. In addition, TCP uses flow and error control
mechanisms at the transport level.
Services provided by TCP are
Process-to-process communication
Stream Delivery service
Sending and receiving buffer
Segments
Full duplex communication
Connection oriented service
Reliable service
20
-
8/7/2019 Lecture 12 - TCP Overview
6/12
CS65-Computer Networks Dept. of EEE
S.Muralidharan 6
Well-known ports used by TCP
21
Stream Delivery
TCP allows the sending process to deliver data as a streamof bytes and allows the receiving process to obtain data as a
stream of bytes.
TCP creates an environment in which the two processes
seem to be connected by an imaginary tube that carries
their data across the Internet.
22
Sending & Receiving Buffers
Since the sending and receiving process may not be
working at the same speed, a circular array of 1-byte length
is used as buffer by both the stations.
23
TCP Segments
Though Transport layer handle in the form of streams of
data, the service provider for Transport layer, ie. Network
layer (IP), handles the data in the form of packets.
Hence TCP groups a number of bytes together into a packet
called Segment and adds a header to it.
These segments are encapsulated by IP datagram and
transmitted.
Segments need not be of same size.
24
-
8/7/2019 Lecture 12 - TCP Overview
7/12
CS65-Computer Networks Dept. of EEE
S.Muralidharan 7
25
Others services.
TCP offers Full Duplex Communication TCP offers Connection oriented service
TCP offers Reliable service
26
Numbering System
Numbering is used forflow & error control
Byte Number : TCP numbers all the data bytes that are transmitted in a connection,
When TCP receives bytes of data from a process, it stores them in the
sending buffer and numbers them.
The numbering scheme start with a random number between 0 and 232
1. Sequence Number :
After numbering each bytes of data, TCP assigns a sequence number to
each segment that is being sent.
The sequence number for each segment is the number of the first byte
carried in that segment.
Acknowledgement Number : It defines the number of next byte that the receiving end expects.
Acknowledgement is cumulative.
27
Example
Imagine a TCP connection is transferring a file of 6000 bytes.
The first byte is numbered 10010.
What are the sequence numbers for each segment if data are sent in five
segments with the first four segments carrying 1000 bytes and the last segment
carrying 2000 bytes?
The following shows the sequence number for each segment:
Segment 1 ==> sequence number: 10010 (range: 10,010 to 11,009)
Segment 2 ==> sequence number: 11010 (range: 11,010 to 12,009)
Segment 3 ==> sequence number: 12010 (range: 12,010 to 13,009)
Segment 4 ==> sequence number: 13010 (range: 13,010 to 14,009)
Segment 5 ==> sequence number: 14010 (range: 14,010 to 16,009)
28
CS65 C t N t k D t f EEE
-
8/7/2019 Lecture 12 - TCP Overview
8/12
CS65-Computer Networks Dept. of EEE
S.Muralidharan 8
TCP Segment Format
TCP Segment consists of a 20-byte(without options) to 60-bytes(with options) header followed by data.
29
Source Portand Destination Port Identifies points at whichupper-layer source and destination processes receive TCP services.
Sequence Number Usually specifies the number assigned tothe first byte of data in the current message. In the connection-establishment phase, this field also can be used to identify an initialsequence number to be used in an upcoming transmission.
Acknowledgment Number Contains the sequence number ofthe next byte of data the sender of the packet expects to receive.
HLEN Header Length - Indicates the number of 32-bit words inthe TCP header and thereby it indicate where the data field begins.
Reserved Remains reserved for future use.
30
Flags (6 bits)
31
Window Specifies the size of the senders receive window (that is,the buffer space available for incoming data).
Checksum used to indicate whether the segment was damaged intransit.
Urgent Pointer Points to the first urgent data byte in the packet.
Options Specifies various TCP options [Max. segment size,window scale upto 214 (i.e., 65,536 x 214 = 107,37,25,440 bytes) &Time stamp option]
Data Contains upper-layer information.
32
CS65 C t N t k D t f EEE
-
8/7/2019 Lecture 12 - TCP Overview
9/12
CS65-Computer Networks Dept. of EEE
S.Muralidharan 9
TCP Header Overload
33
Connection establishment using three-way handshaking
Connection establishment By Three way handshake
Between pairs of ports
One port can connect to multiple destinations
Server program informs its TCP that it is ready to accept any
connection. This is called Passive open. But a server cannot initiate
any connection.
A client program issues a request for an active open
Malicious attacker may send a large number of SYN segments to the
server, pretending that each of them is coming from a different client
by faking the source. Without knowing this server may startedallocating its resources, which sometimes lead to server crash. This
attack is called SYN flooding attack and to manage this situation
server may restrict the number of connections or avoid requests from
unwanted sources.
34
Connection establishment using three-way handshaking
A SYN segmentcannot carry data,
but it consumes onesequence number
A SYN+ACK
segment cannotcarry data, but does
consume onesequence number
An ACK segment, ifcarrying no data,
consumes nosequence number.
35
Data Transfer
Data transfer
Logical stream of octets
Octets numbered modulo 232
Flow control by credit allocation of number of octets
Data buffered at transmitter and receiver
To overcome buffering and requiring immediate attention, data istransferred with PSH flag set.
To draw the immediate attention by the receiving TCP, URG flag is
used.
36
CS65 Computer Networks Dept of EEE
-
8/7/2019 Lecture 12 - TCP Overview
10/12
CS65-Computer Networks Dept. of EEE
S.Muralidharan 10
Data transfer
37
Connection termination using three-way handshaking
Connection termination Graceful close
TCP users issues CLOSE primitive
Transport entity sets FIN flag on last segment sent
Abrupt termination by ABORT primitive
Entity abandons all attempts to send or receive data
RST segment transmitted
38
Connection termination using three-way handshaking
FIN segment
consumes one
sequence number
if it does not carrydata
The FIN+ACKsegment
consumes onesequence
number if itdoes not carry
data
39
Half-close
40
CS65 Computer Networks Dept of EEE
-
8/7/2019 Lecture 12 - TCP Overview
11/12
CS65-Computer Networks Dept. of EEE
S.Muralidharan 11
TCP a state transition diagram
input/output
Client
Server
41
Flow control
The amount of data a source can send before receiving
an ACK from the destination
Whether to send 1 byte of data and wait for ACK or send
all the bytes and wait for the ACK for the complete
message?
TCP gives a solution in between
Sliding window protocol
byte oriented
Already dealt along with Unit I
42
USER DATAGRAM PROTOCOL(UDP)
It is the simplest form of transport protocol.
The datagram packet of this protocol has the followingfields
Source port address :Address of the application program that hascreated the message.
Destination port address : Address of the application program
that will receive the message Total length : The total length field defines the total length of the
user datagram in bytes
Check sum : The checksum is a 16-bit field used in errordetection
Data
43
UDP Header
44
-
8/7/2019 Lecture 12 - TCP Overview
12/12