SlideShare a Scribd company logo
1
Transmission Control Protocol
K. PALANIVEL
Systems Analyst, Computer Centre
Pondicherry University, Puducherry – 605014.
LECTURE 8
COMS 525: TCPIP
COURSE
TOPIC
Part - I
Transmission Control Protocol
Purpose of the Transport Layer
• The Transport layer provides for the segmentation
of data and the control necessary to reassemble
these pieces into the various communication
streams.
• Its primary responsibilities to accomplish this are:
– Tracking the individual communication between
applications on the source and destination hosts
– Segmenting data and managing each piece
– Reassembling the segments into streams of
application data
– Identifying the different applications
Identifying the 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.
• The Transport layer is the link between the Application
layer and the lower layer that are responsible for network
transmission.
Data Requirements Vary
• Because different applications have different requirements,
there are multiple Transport layer protocols.
• For some applications, segments must arrive in a very
specific sequence in order to be processed successfully.
• In some cases, all of the data must be received for any of it
to be of use.
• In other cases, an application can tolerate some loss of data
during transmission over the network.
• In today's converged networks, applications with very
different transport needs may be communicating on the same
network.
• The different Transport layer protocols have different rules
allowing devices to handle these diverse data requirements.
Data Requirements Vary
Separating Multiple Communications
• Consider a computer connected to a network that is
simultaneously receiving and sending e-mail and instant
messages, viewing websites, file downloading and
conducting a VoIP phone call.
• Each of these applications is sending and receiving data
over the network at the same time.
• However,
– data from the phone call is not directed to the web
browser?
– text from an instant message does not appear in an e-
mail ?
Separating Multiple Communications
Separating Multiple Communications
• At the Transport layer, each particular set of pieces
flowing between a source application and a destination
application is known as a conversation.
• To identify each segment of data, the Transport layer
adds to the piece a header containing binary data.
• This header contains fields of bits. It is the values in
these fields that enable different Transport layer
protocols to perform different functions.
Separating Multiple Communications
Functions Specified Transport Layer
• Segmentation and Reassembly -
– Most networks have a limitation on the amount of
data that can be included in a single PDU.
– The Transport layer divides application data into
blocks of data that are an appropriate size.
– At the destination, the Transport layer reassembles
the data before sending it to the destination
application or service.
Functions Specified Transport Layer
Functions Specified Transport Layer
• Conversation Multiplexing
– There may be many applications or services running
on each host in the network.
– Each of these applications or services is assigned an
address known as a port so that the Transport layer
can determine with which application or service the
data is identified.
Functions Specified Transport Layer
• In addition to using the information contained in the
headers, for the basic functions of data segmentation
and reassembly, some protocols at the Transport layer
provide:
– Connection-oriented conversations
– Reliable delivery
– Ordered data reconstruction
– Flow control
Functions Specified Transport Layer
Functions Specified Transport Layer
• Establishing a Session
– The Transport layer can provide this connection orientation
by creating a sessions between the applications.
– These connections prepare the applications to communicate
with each other before any data is transmitted.
– Within these sessions, the data for a communication between
the two applications can be closely managed.
• Reliable Delivery
– For many reasons, it is possible for a piece of data to become
corrupted, or lost completely, as it is transmitted over the
network.
– The Transport layer can ensure that all pieces reach their
destination by having the source device to retransmit any data
that is lost.
Functions Specified Transport Layer
• Same Order Delivery
– Because networks may provide multiple routes that can have
different transmission times, data can arrive in the wrong order.
– By numbering and sequencing the segments, the Transport layer can
ensure that these segments are reassembled into the proper order.
• Flow Control
– Network hosts have limited resources, such as memory or
bandwidth.
– When Transport layer is aware that these resources are overtaxed,
some protocols can request that the sending application reduce the
rate of data flow.
– This is done at the Transport layer by regulating the amount of data
the source transmits as a group.
– Flow control can prevent the loss of segments on the network and
avoid the need for retransmission.
Functions Specified Transport Layer
Overview
TCP = Transmission Control Protocol
Connection-oriented protocol
Provides a reliable unicast end-to-end byte stream
over an unreliable internetwork.
TCP
IP Internetwork
ByteStream
ByteStream
TCP
Connection-Oriented
Before any data transfer, TCP establishes a connection:
 One TCP entity is waiting for a connection (“server”)
The other TCP entity (“client”) contacts the server
The actual procedure for setting up connections is more complex.
Each connection is full duplex
CLIENT SERVER
waiting for
connection
request
Request a connection
Accept a connection
Disconnect
Data Transer
Connection-Oriented
Connection Establishment and Termination
Connection-Oriented
Connection Establishment and Termination
Connection-Oriented
Connection Establishment and Termination
Connection-Oriented: Acknowledgement
Reliable
• Byte stream is broken up into chunks which are called
segments
• Receiver sends acknowledgements (ACKs) for segments
• TCP maintains a timer. If an ACK is not received in
time, the segment is retransmitted
• Detecting errors
• TCP has checksums for header and data. Segments with
invalid checksums are discarded
• Each byte that is transmitted has a sequence number
Three-Way Handshake : Step 1
• A TCP client begins the three-way handshake by sending a
segment with the SYN (Synchronize Sequence Number)
control flag set, indicating an initial value in the sequence
number field in the header.
• This initial value for the sequence number, known as the
Initial Sequence Number (ISN), is randomly chosen and is
used to begin tracking the flow of data from the client to
the server for this session.
• The ISN in the header of each segment is increased by one
for each byte of data sent from the client to the server as
the data conversation continues.
Three-Way Handshake : Step 1
Three-Way Handshake : Step 2
• The TCP server needs to acknowledge the receipt of the SYN
segment from the client to establish the session from the client
to the server.
• The TCP server sends a segment back to the client with the
ACK flag set indicating that the Acknowledgment number is
significant.
• With this flag set in the segment, the client recognizes this as an
acknowledgement that the server received the SYN from the
TCP client.
• The value of the acknowledgment number field is equal to the
client initial sequence number plus 1.
• This establishes a session from the client to the server.
Three-Way Handshake : Step 2
Three-Way Handshake : Step 3
• Finally, the TCP client responds with a segment
containing an ACK that is the response to the TCP
SYN sent by the server.
• There is no user data in this segment.
• The value in the acknowledgment number field
contains one more than the initial sequence number
received from the server.
• Once both sessions are established between client and
server, all additional segments exchanged in this
communication will have the ACK flag set.
Three-Way Handshake : Step 3
TCP Termination
• To close a connection, the FIN (Finish) control flag in
the segment header must be set.
• To end each one-way TCP session, a two-way
handshake is used, consisting of a FIN segment and an
ACK segment.
• Therefore, to terminate a single conversation
supported by TCP, four exchanges are needed to end
both sessions.
TCP Termination
1. When the client has no more data to send in the
stream, it sends a segment with the FIN flag set.
2. The server sends an ACK to acknowledge the receipt
of the FIN to terminate the session from client to
server.
3. The server sends a FIN to the client, to terminate the
server to client session.
4. The client responds with an ACK to acknowledge the
FIN from the server.
TCP Termination
Byte Stream Service
• To the lower layers, TCP handles data in blocks, the
segments.
• To the higher layers TCP handles data as a sequence of
bytes and does not identify boundaries between bytes
• So: Higher layers do not know about the beginning and
end of segments !
TCP
Application
1. write 100 bytes
2. write 20 bytes
queue of
bytes to be
transmitted TCP
queue of
bytes that
have been
received
Application
1. read 40 bytes
2. read 40 bytes
3. read 40 bytes
Segments
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 header fields
Port Number:
◦ A port number identifies the endpoint of a connection.
◦ A pair <IP address, port number> identifies one endpoint
of a connection.
◦ Two pairs <client IP address, server port number> and
<server IP address, server port number> identify a TCP
connection.
TCP
IP
Applications
23 10480Ports:
TCP
IP
Applications
7 1680 Ports:
TCP header fields
Sequence Number (SeqNo):
 Sequence number is 32 bits long.
 So the range of SeqNo is
0 <= SeqNo <= 232 -1  4.3 Gbyte
 Each sequence number identifies a byte in the byte
stream
 Initial Sequence Number (ISN) of a connection is set
during connection establishment for ISN ?
TCP header fields
 Acknowledgement Number (AckNo):
 Acknowledgements are piggybacked, i.e., a segment
from A -> B can contain an acknowledgement for a data
sent in the B -> A direction
 Q: Why is piggA hosts uses the AckNo field to send
acknowledgements. (If a host sends an AckNo in a
segment it sets the “ACK flag”)
 The AckNo contains the next SeqNo that a hosts wants to
receive .
Example: The acknowledgement for a segment with
sequence numbers 0-1500 is AckNo=1501y backing good ?
TCP header fields
Acknowledge Number (cont’d)
TCP uses the sliding window flow protocol to regulate
the flow of traffic from sender to receiver
TCP uses the following variation of sliding window:
no NACKs (Negative ACKnowledgement)
only cumulative ACKs
Example:
Assume: Sender sends two segments with “1..1500” and
“1501..3000”, but receiver only gets the second
segment.
In this case, the receiver cannot acknowledge the second
packet. It can only send AckNo=1
TCP header fields
• Header Length ( 4bits):
– Length of header in 32-bit words
– Note that TCP header has variable length (with
minimum 20 bytes)
TCP header fields
 Flag bits:
◦ URG: Urgent pointer is valid
 If the bit is set, the following bytes contain an urgent
message in the range:
SeqNo <= urgent message <= SeqNo+urgent pointer
◦ ACK: Acknowledgement Number is valid
◦ PSH: PUSH Flag
 Notification from sender to the receiver that the receiver
should pass all data that it has to the application.
 Normally set by sender when the sender’s buffer is empty
TCP header fields
 Flag bits:
◦ RST: Reset the connection
 The flag causes the receiver to reset the connection
 Receiver of a RST terminates the connection and
indicates higher layer application about the reset
◦ SYN: Synchronize sequence numbers
 Sent in the first packet when initiating a connection
◦ FIN: Sender is finished with sending
 Used for closing a connection
 Both sides of a connection must send a FIN
TCP Header Fields
Window Size:
Each side of the connection advertises the window
size
Window size is the maximum number of bytes that a
receiver can accept.
Maximum window size is 216-1= 65535 bytes
TCP Checksum:
TCP checksum covers over both TCP header and
TCP data (also covers some parts of the IP header)
Urgent Pointer:
Only valid if URG flag is set
TCP Header Fields
• Options
End of
Options kind=0
1 byte
NOP
(no operation) kind=1
1 byte
Maximum
Segment Size
kind=2
1 byte
len=4
1 byte
maximum
segment size
2 bytes
Window Scale
Factor
kind=3
1 byte
len=3
1 byte
shift count
1 byte
Timestamp kind=8
1 byte
len=10
1 byte
timestamp value
4 bytes
timestamp echo reply
4 bytes
TCP Header Fields
Options:
NOP is used to pad TCP header to multiples of 4 bytes
Maximum Segment Size
Window Scale Options
Increases the TCP window from 16 to 32 bits, I.e.,
the window size is interpreted differently: What is
the different interpretation ?
This option can only be used in the SYN segment
(first segment) during connection establishment time
Timestamp Option
Can be used for roundtrip measurements
Connection Management in TCP
• Opening a TCP Connection
• Closing a TCP Connection
• Special Scenarios
• State Diagram
TCP Connection Establishment
TCP uses a three-way handshake to open a connection:
(1) ACTIVE OPEN: Client sends a segment with
SYN bit set *
port number of client
initial sequence number (ISN) of client
(2) PASSIVE OPEN: Server responds with a segment with
SYN bit set *
initial sequence number of server
ACK for ISN of client
(3) Client acknowledges by sending a segment with:
 ACK ISN of server (* counts as one byte)
Three-Way Handshake
aida.poly.edu mng.poly.edu
SYN (SeqNo = x)
SYN (SeqNo = y, AckNo = x + 1 )
(SeqNo = x+1, AckNo = y + 1 )
TCP Connection Termination
 Each end of the data flow must be shut down
independently (“half-close”)
 If one end is done it sends a FIN segment. This means
that no more data will be sent
 Four steps involved:
(1) X sends a FIN to Y (active close)
(2) Y ACKs the FIN,
(at this time: Y can still send data to X)
(3) and Y sends a FIN to X (passive close)
(4) X ACKs the FIN.
TCP States
State Description
CLOSED No connection is active or pending
LISTEN The server is waiting for an incoming call
SYN RCVD A connection request has arrived; wait for Ack
SYN SENT The client has started to open a connection
ESTABLISHED Normal data transfer state
FIN WAIT 1 Client has said it is finished
FIN WAIT 2 Server has agreed to release
TIMED WAIT Wait for pending packets (“2MSL wait state”)
CLOSING Both Sides have tried to close simultanesously
CLOSE WAIT Server has initiated a release
LAST ACK Wait for pending packets
TCP States in “Normal” Connection Lifetime
SYN (SeqNo = x)
SYN (SeqNo = y, AckNo = x + 1 )
(AckNo = y + 1 )
SYN_SENT
(active open)
SYN_RCVD
ESTABLISHED
ESTABLISHED
FIN_WAIT_1
(active close)
LISTEN
(passive open)
FIN (SeqNo = m)
CLOSE_WAIT
(passive close)
(AckNo = m+ 1 )
FIN (SeqNo = n )
(AckNo = n+1)
LAST_ACK
FIN_WAIT_2
TIME_WAIT
CLOSED
TCP State Transition Diagram: Opening A Connection
CLOSED
LISTEN
SYN RCVD SYN SENT
ESTABLISHED
active open
send: SYN
recv: SYN, ACK
send: ACK
recv: SYN
send: SYN, ACK
recvd: ACK
send: . / .
recv:
RST
Application sends data
send: SYN
simultaneous open
recv: SYN
send: SYN, ACK
close or
timeout
passive open
send: . / .
recvd: FIN send: FIN
send:
FIN
TCP State Transition Diagram: Closing A Connection
FIN_WAIT_1
FIN_WAIT_2
ESTABLISHED
recv: FIN
send: ACK
recv: ACK
send: . / .
recvd: ACK
send: . / .
recv:
FIN, ACK
send: ACK
active close
send: FIN
TIME_WAIT
CLOSING
recv: FIN
send: ACK
CLOSED
Timeout
(2 MSL)
CLOSE_WAIT
LAST_ACK
passive close
recv: FIN
send: ACK
application
closes
send: FIN
recv: ACK
send: . / .
2MSL(Maximum Segment Lifetime) Wait State
2MSL Wait State = TIME_WAIT
When TCP does an active close, and sends the final ACK,
the connection must stay in in the TIME_WAIT state for
twice the maximum segment lifetime.
2MSL= 2 * Maximum Segment Lifetime
Why?
TCP is given a chance to resent the final ACK. (Server
will timeout after sending the FIN segment and resend the
FIN)
The MSL is set to 2 minutes or 1 minute or 30 seconds.
Resetting Connections
• Resetting connections is done by setting the RST flag
• When is the RST flag set?
– Connection request arrives and no server process is
waiting on the destination port
– Abort (Terminate) a connection
Causes the receiver to throw away buffered data.
Receiver does not acknowledge the RST segment
Flow Control
• TCP also provides mechanisms for 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.
Flow Control
• 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.
Flow Control
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.
Reducing Window Size
• Another way to control the data flow
• 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.
Reducing Window Size
• If a receiving host has congestion, it may respond to
the sending host with a segment with a reduced
window size.
• In this graphic, there was a loss of one of the segments.
• The receiver changed the window field in the TCP
header of the returning segments in this conversation
from 3000 down to 1500.
• This caused the sender to reduce the window size to
1500.
Reducing Window Size
• After periods of transmission with no data losses or
constrained resources, the receiver will begin to
increase the window field.
• This reduces the overhead on the network because
fewer acknowledgments need to be sent.
• Window size will continue to increase until there is
data loss, which will cause the window size to be
decreased.
• This dynamic increasing and decreasing of window
size is a continuous process in TCP, which determines
the optimum window size for each TCP session.
Reducing Window Size
• In highly efficient networks, window sizes may
become very large because data is not being lost. In
networks where the underlying infrastructure is being
stressed, the window size will likely remain small.
QUESTIONS ???

More Related Content

What's hot (20)

Chapter 3 final
Chapter 3 finalChapter 3 final
Chapter 3 final
 
Transport protocols
Transport protocolsTransport protocols
Transport protocols
 
IP/MAC Address Translation
IP/MAC Address TranslationIP/MAC Address Translation
IP/MAC Address Translation
 
Transport Layer
Transport LayerTransport Layer
Transport Layer
 
Transport layer
Transport layerTransport layer
Transport layer
 
Transport Protocols
Transport ProtocolsTransport Protocols
Transport Protocols
 
The Transport Layer
The Transport LayerThe Transport Layer
The Transport Layer
 
TCP - IP Presentation
TCP - IP PresentationTCP - IP Presentation
TCP - IP Presentation
 
Tcp
TcpTcp
Tcp
 
TCP/IP Protocols
TCP/IP ProtocolsTCP/IP Protocols
TCP/IP Protocols
 
transport layer
transport layertransport layer
transport layer
 
Tcp ip-ppt
Tcp ip-pptTcp ip-ppt
Tcp ip-ppt
 
Chapter13
Chapter13Chapter13
Chapter13
 
Transport layer
Transport layerTransport layer
Transport layer
 
Tcpip services and applications
Tcpip services and applicationsTcpip services and applications
Tcpip services and applications
 
Transport Layer In Computer Network
Transport Layer In Computer NetworkTransport Layer In Computer Network
Transport Layer In Computer Network
 
Computer networks unit i
Computer networks    unit iComputer networks    unit i
Computer networks unit i
 
Project on wifi ,LTE and Broadband devices
Project on wifi ,LTE and Broadband devicesProject on wifi ,LTE and Broadband devices
Project on wifi ,LTE and Broadband devices
 
TCP/IP Basics
TCP/IP BasicsTCP/IP Basics
TCP/IP Basics
 
TCP / IP Services and Standards
TCP / IP Services and StandardsTCP / IP Services and Standards
TCP / IP Services and Standards
 

Similar to 08 coms 525 tcpip - tcp 1

Unit-4 (1).pptx
Unit-4 (1).pptxUnit-4 (1).pptx
Unit-4 (1).pptxpoonamsngr
 
Computer network transport layer MODUL 2.pptx
Computer network transport layer MODUL 2.pptxComputer network transport layer MODUL 2.pptx
Computer network transport layer MODUL 2.pptxpallavir61
 
Transport Layer [Autosaved]
Transport Layer [Autosaved]Transport Layer [Autosaved]
Transport Layer [Autosaved]Ram Dutt Shukla
 
TCP/IP 3-way Handshake
TCP/IP 3-way Handshake TCP/IP 3-way Handshake
TCP/IP 3-way Handshake Alok Tripathi
 
CCNA (R & S) Module 01 - Introduction to Networks - Chapter 9
CCNA (R & S) Module 01 - Introduction to Networks - Chapter 9CCNA (R & S) Module 01 - Introduction to Networks - Chapter 9
CCNA (R & S) Module 01 - Introduction to Networks - Chapter 9Waqas Ahmed Nawaz
 
Unit 4-Transport Layer Protocols-3.pptx
Unit 4-Transport Layer Protocols-3.pptxUnit 4-Transport Layer Protocols-3.pptx
Unit 4-Transport Layer Protocols-3.pptxDESTROYER39
 
Unit 4-Transport Layer Protocols.pptx
Unit 4-Transport Layer Protocols.pptxUnit 4-Transport Layer Protocols.pptx
Unit 4-Transport Layer Protocols.pptxsarosh32
 
Transmission Control Protocol_ Computer Networks
Transmission Control Protocol_ Computer NetworksTransmission Control Protocol_ Computer Networks
Transmission Control Protocol_ Computer NetworksManimaran A
 
Lecture 1 Network Reference Models Final.pptx
Lecture 1 Network Reference Models Final.pptxLecture 1 Network Reference Models Final.pptx
Lecture 1 Network Reference Models Final.pptxRonoh Kennedy
 
Client Server Network and Peer to Peer.pptx
Client Server Network and Peer to Peer.pptxClient Server Network and Peer to Peer.pptx
Client Server Network and Peer to Peer.pptxDevChaudhari17
 
tcp-ippresentation-150614172243-lva1-app6892.pptx
tcp-ippresentation-150614172243-lva1-app6892.pptxtcp-ippresentation-150614172243-lva1-app6892.pptx
tcp-ippresentation-150614172243-lva1-app6892.pptxAlphaKoiSylvester
 

Similar to 08 coms 525 tcpip - tcp 1 (20)

TCP /IP
TCP /IPTCP /IP
TCP /IP
 
Unit-4 (1).pptx
Unit-4 (1).pptxUnit-4 (1).pptx
Unit-4 (1).pptx
 
Transport layer.pptx
Transport layer.pptxTransport layer.pptx
Transport layer.pptx
 
Osi layer model
Osi layer modelOsi layer model
Osi layer model
 
Computer network transport layer MODUL 2.pptx
Computer network transport layer MODUL 2.pptxComputer network transport layer MODUL 2.pptx
Computer network transport layer MODUL 2.pptx
 
Transport Layer [Autosaved]
Transport Layer [Autosaved]Transport Layer [Autosaved]
Transport Layer [Autosaved]
 
Transport layer protocol
Transport layer protocolTransport layer protocol
Transport layer protocol
 
TCP/IP 3-way Handshake
TCP/IP 3-way Handshake TCP/IP 3-way Handshake
TCP/IP 3-way Handshake
 
CCNA (R & S) Module 01 - Introduction to Networks - Chapter 9
CCNA (R & S) Module 01 - Introduction to Networks - Chapter 9CCNA (R & S) Module 01 - Introduction to Networks - Chapter 9
CCNA (R & S) Module 01 - Introduction to Networks - Chapter 9
 
Unit 4-Transport Layer Protocols-3.pptx
Unit 4-Transport Layer Protocols-3.pptxUnit 4-Transport Layer Protocols-3.pptx
Unit 4-Transport Layer Protocols-3.pptx
 
Unit 4-Transport Layer Protocols.pptx
Unit 4-Transport Layer Protocols.pptxUnit 4-Transport Layer Protocols.pptx
Unit 4-Transport Layer Protocols.pptx
 
Tcp3 wayhandshakeprocess
Tcp3 wayhandshakeprocessTcp3 wayhandshakeprocess
Tcp3 wayhandshakeprocess
 
Tcp ip
Tcp ipTcp ip
Tcp ip
 
The OSI model
 The OSI model The OSI model
The OSI model
 
Transmission Control Protocol_ Computer Networks
Transmission Control Protocol_ Computer NetworksTransmission Control Protocol_ Computer Networks
Transmission Control Protocol_ Computer Networks
 
Cn
CnCn
Cn
 
Lecture 1 Network Reference Models Final.pptx
Lecture 1 Network Reference Models Final.pptxLecture 1 Network Reference Models Final.pptx
Lecture 1 Network Reference Models Final.pptx
 
Client Server Network and Peer to Peer.pptx
Client Server Network and Peer to Peer.pptxClient Server Network and Peer to Peer.pptx
Client Server Network and Peer to Peer.pptx
 
tcp-ippresentation-150614172243-lva1-app6892.pptx
tcp-ippresentation-150614172243-lva1-app6892.pptxtcp-ippresentation-150614172243-lva1-app6892.pptx
tcp-ippresentation-150614172243-lva1-app6892.pptx
 
Transport layer
Transport layer Transport layer
Transport layer
 

More from Palanivel Kuppusamy

16 coms 525 tcpip - routing protocols -all
16    coms 525 tcpip - routing protocols -all16    coms 525 tcpip - routing protocols -all
16 coms 525 tcpip - routing protocols -allPalanivel Kuppusamy
 
15 coms 525 tcpip - border gateway protocols
15    coms 525 tcpip - border gateway protocols15    coms 525 tcpip - border gateway protocols
15 coms 525 tcpip - border gateway protocolsPalanivel Kuppusamy
 
14 coms 525 tcpip - applications - snmp
14    coms 525 tcpip - applications - snmp14    coms 525 tcpip - applications - snmp
14 coms 525 tcpip - applications - snmpPalanivel Kuppusamy
 
13 coms 525 tcpip - applications - file transfer protocol
13   coms 525 tcpip - applications - file transfer protocol13   coms 525 tcpip - applications - file transfer protocol
13 coms 525 tcpip - applications - file transfer protocolPalanivel Kuppusamy
 
12 coms 525 tcpip - applications - http - telnet
12   coms 525 tcpip - applications - http - telnet12   coms 525 tcpip - applications - http - telnet
12 coms 525 tcpip - applications - http - telnetPalanivel Kuppusamy
 
11 coms 525 tcpip - internet protocol - forward
11   coms 525 tcpip - internet protocol - forward11   coms 525 tcpip - internet protocol - forward
11 coms 525 tcpip - internet protocol - forwardPalanivel Kuppusamy
 
10 coms 525 tcpip - internet protocol - ip
10   coms 525 tcpip -  internet protocol - ip10   coms 525 tcpip -  internet protocol - ip
10 coms 525 tcpip - internet protocol - ipPalanivel Kuppusamy
 
07 coms 525 tcpip - udp [autosaved]
07    coms 525 tcpip - udp [autosaved]07    coms 525 tcpip - udp [autosaved]
07 coms 525 tcpip - udp [autosaved]Palanivel Kuppusamy
 
06 coms 525 tcpip - dhcp and dns
06   coms 525 tcpip - dhcp and dns06   coms 525 tcpip - dhcp and dns
06 coms 525 tcpip - dhcp and dnsPalanivel Kuppusamy
 
04 coms 525 tcpip - arp and rarp
04   coms 525 tcpip - arp and rarp04   coms 525 tcpip - arp and rarp
04 coms 525 tcpip - arp and rarpPalanivel Kuppusamy
 
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 tcpipPalanivel Kuppusamy
 
01 coms 525 tcpip - networking concepts review
01   coms 525 tcpip - networking concepts review01   coms 525 tcpip - networking concepts review
01 coms 525 tcpip - networking concepts reviewPalanivel Kuppusamy
 
00 coms 525 tcpip - introduction to networks
00   coms 525 tcpip -  introduction to networks00   coms 525 tcpip -  introduction to networks
00 coms 525 tcpip - introduction to networksPalanivel Kuppusamy
 

More from Palanivel Kuppusamy (17)

16 coms 525 tcpip - routing protocols -all
16    coms 525 tcpip - routing protocols -all16    coms 525 tcpip - routing protocols -all
16 coms 525 tcpip - routing protocols -all
 
15 coms 525 tcpip - border gateway protocols
15    coms 525 tcpip - border gateway protocols15    coms 525 tcpip - border gateway protocols
15 coms 525 tcpip - border gateway protocols
 
14 coms 525 tcpip - applications - snmp
14    coms 525 tcpip - applications - snmp14    coms 525 tcpip - applications - snmp
14 coms 525 tcpip - applications - snmp
 
13 coms 525 tcpip - applications - file transfer protocol
13   coms 525 tcpip - applications - file transfer protocol13   coms 525 tcpip - applications - file transfer protocol
13 coms 525 tcpip - applications - file transfer protocol
 
12 coms 525 tcpip - applications - http - telnet
12   coms 525 tcpip - applications - http - telnet12   coms 525 tcpip - applications - http - telnet
12 coms 525 tcpip - applications - http - telnet
 
11 coms 525 tcpip - internet protocol - forward
11   coms 525 tcpip - internet protocol - forward11   coms 525 tcpip - internet protocol - forward
11 coms 525 tcpip - internet protocol - forward
 
10 coms 525 tcpip - internet protocol - ip
10   coms 525 tcpip -  internet protocol - ip10   coms 525 tcpip -  internet protocol - ip
10 coms 525 tcpip - internet protocol - ip
 
09 coms 525 tcpip - tcp 2
09   coms 525 tcpip - tcp 209   coms 525 tcpip - tcp 2
09 coms 525 tcpip - tcp 2
 
07 coms 525 tcpip - udp
07    coms 525 tcpip - udp07    coms 525 tcpip - udp
07 coms 525 tcpip - udp
 
07 coms 525 tcpip - udp [autosaved]
07    coms 525 tcpip - udp [autosaved]07    coms 525 tcpip - udp [autosaved]
07 coms 525 tcpip - udp [autosaved]
 
06 coms 525 tcpip - dhcp and dns
06   coms 525 tcpip - dhcp and dns06   coms 525 tcpip - dhcp and dns
06 coms 525 tcpip - dhcp and dns
 
05 coms 525 tcpip - icmp
05   coms 525 tcpip - icmp05   coms 525 tcpip - icmp
05 coms 525 tcpip - icmp
 
04 coms 525 tcpip - arp and rarp
04   coms 525 tcpip - arp and rarp04   coms 525 tcpip - arp and rarp
04 coms 525 tcpip - arp and rarp
 
03 coms 525 tcpip - ip address
03   coms 525 tcpip -  ip address03   coms 525 tcpip -  ip address
03 coms 525 tcpip - ip address
 
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
 
01 coms 525 tcpip - networking concepts review
01   coms 525 tcpip - networking concepts review01   coms 525 tcpip - networking concepts review
01 coms 525 tcpip - networking concepts review
 
00 coms 525 tcpip - introduction to networks
00   coms 525 tcpip -  introduction to networks00   coms 525 tcpip -  introduction to networks
00 coms 525 tcpip - introduction to networks
 

Recently uploaded

How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17Celine George
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersPedroFerreira53928
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesRased Khan
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfVivekanand Anglo Vedic Academy
 
Morse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptxMorse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptxjmorse8
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resourcesdimpy50
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringDenish Jangid
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345beazzy04
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...Nguyen Thanh Tu Collection
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePedroFerreira53928
 
The Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryThe Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryEugene Lysak
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxbennyroshan06
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfbu07226
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfQucHHunhnh
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxCapitolTechU
 
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxJose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxricssacare
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXMIRIAMSALINAS13
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportAvinash Rai
 

Recently uploaded (20)

How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
B.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdfB.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdf
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matrices
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Morse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptxMorse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptx
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resources
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
The Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryThe Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. Henry
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
 
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxJose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
 
Mattingly "AI & Prompt Design: Limitations and Solutions with LLMs"
Mattingly "AI & Prompt Design: Limitations and Solutions with LLMs"Mattingly "AI & Prompt Design: Limitations and Solutions with LLMs"
Mattingly "AI & Prompt Design: Limitations and Solutions with LLMs"
 

08 coms 525 tcpip - tcp 1

  • 1. 1 Transmission Control Protocol K. PALANIVEL Systems Analyst, Computer Centre Pondicherry University, Puducherry – 605014. LECTURE 8 COMS 525: TCPIP COURSE TOPIC Part - I
  • 3. Purpose of the Transport Layer • The Transport layer provides for the segmentation of data and the control necessary to reassemble these pieces into the various communication streams. • Its primary responsibilities to accomplish this are: – Tracking the individual communication between applications on the source and destination hosts – Segmenting data and managing each piece – Reassembling the segments into streams of application data – Identifying the different applications
  • 4. Identifying the 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. • The Transport layer is the link between the Application layer and the lower layer that are responsible for network transmission.
  • 5. Data Requirements Vary • Because different applications have different requirements, there are multiple Transport layer protocols. • For some applications, segments must arrive in a very specific sequence in order to be processed successfully. • In some cases, all of the data must be received for any of it to be of use. • In other cases, an application can tolerate some loss of data during transmission over the network. • In today's converged networks, applications with very different transport needs may be communicating on the same network. • The different Transport layer protocols have different rules allowing devices to handle these diverse data requirements.
  • 7. Separating Multiple Communications • Consider a computer connected to a network that is simultaneously receiving and sending e-mail and instant messages, viewing websites, file downloading and conducting a VoIP phone call. • Each of these applications is sending and receiving data over the network at the same time. • However, – data from the phone call is not directed to the web browser? – text from an instant message does not appear in an e- mail ?
  • 9. Separating Multiple Communications • At the Transport layer, each particular set of pieces flowing between a source application and a destination application is known as a conversation. • To identify each segment of data, the Transport layer adds to the piece a header containing binary data. • This header contains fields of bits. It is the values in these fields that enable different Transport layer protocols to perform different functions.
  • 11. Functions Specified Transport Layer • Segmentation and Reassembly - – Most networks have a limitation on the amount of data that can be included in a single PDU. – The Transport layer divides application data into blocks of data that are an appropriate size. – At the destination, the Transport layer reassembles the data before sending it to the destination application or service.
  • 13. Functions Specified Transport Layer • Conversation Multiplexing – There may be many applications or services running on each host in the network. – Each of these applications or services is assigned an address known as a port so that the Transport layer can determine with which application or service the data is identified.
  • 14. Functions Specified Transport Layer • In addition to using the information contained in the headers, for the basic functions of data segmentation and reassembly, some protocols at the Transport layer provide: – Connection-oriented conversations – Reliable delivery – Ordered data reconstruction – Flow control
  • 16. Functions Specified Transport Layer • Establishing a Session – The Transport layer can provide this connection orientation by creating a sessions between the applications. – These connections prepare the applications to communicate with each other before any data is transmitted. – Within these sessions, the data for a communication between the two applications can be closely managed. • Reliable Delivery – For many reasons, it is possible for a piece of data to become corrupted, or lost completely, as it is transmitted over the network. – The Transport layer can ensure that all pieces reach their destination by having the source device to retransmit any data that is lost.
  • 17. Functions Specified Transport Layer • Same Order Delivery – Because networks may provide multiple routes that can have different transmission times, data can arrive in the wrong order. – By numbering and sequencing the segments, the Transport layer can ensure that these segments are reassembled into the proper order. • Flow Control – Network hosts have limited resources, such as memory or bandwidth. – When Transport layer is aware that these resources are overtaxed, some protocols can request that the sending application reduce the rate of data flow. – This is done at the Transport layer by regulating the amount of data the source transmits as a group. – Flow control can prevent the loss of segments on the network and avoid the need for retransmission.
  • 19. Overview TCP = Transmission Control Protocol Connection-oriented protocol Provides a reliable unicast end-to-end byte stream over an unreliable internetwork. TCP IP Internetwork ByteStream ByteStream TCP
  • 20. Connection-Oriented Before any data transfer, TCP establishes a connection:  One TCP entity is waiting for a connection (“server”) The other TCP entity (“client”) contacts the server The actual procedure for setting up connections is more complex. Each connection is full duplex CLIENT SERVER waiting for connection request Request a connection Accept a connection Disconnect Data Transer
  • 25. Reliable • Byte stream is broken up into chunks which are called segments • Receiver sends acknowledgements (ACKs) for segments • TCP maintains a timer. If an ACK is not received in time, the segment is retransmitted • Detecting errors • TCP has checksums for header and data. Segments with invalid checksums are discarded • Each byte that is transmitted has a sequence number
  • 26. Three-Way Handshake : Step 1 • A TCP client begins the three-way handshake by sending a segment with the SYN (Synchronize Sequence Number) control flag set, indicating an initial value in the sequence number field in the header. • This initial value for the sequence number, known as the Initial Sequence Number (ISN), is randomly chosen and is used to begin tracking the flow of data from the client to the server for this session. • The ISN in the header of each segment is increased by one for each byte of data sent from the client to the server as the data conversation continues.
  • 28. Three-Way Handshake : Step 2 • The TCP server needs to acknowledge the receipt of the SYN segment from the client to establish the session from the client to the server. • The TCP server sends a segment back to the client with the ACK flag set indicating that the Acknowledgment number is significant. • With this flag set in the segment, the client recognizes this as an acknowledgement that the server received the SYN from the TCP client. • The value of the acknowledgment number field is equal to the client initial sequence number plus 1. • This establishes a session from the client to the server.
  • 30. Three-Way Handshake : Step 3 • Finally, the TCP client responds with a segment containing an ACK that is the response to the TCP SYN sent by the server. • There is no user data in this segment. • The value in the acknowledgment number field contains one more than the initial sequence number received from the server. • Once both sessions are established between client and server, all additional segments exchanged in this communication will have the ACK flag set.
  • 32. TCP Termination • To close a connection, the FIN (Finish) control flag in the segment header must be set. • To end each one-way TCP session, a two-way handshake is used, consisting of a FIN segment and an ACK segment. • Therefore, to terminate a single conversation supported by TCP, four exchanges are needed to end both sessions.
  • 33. TCP Termination 1. When the client has no more data to send in the stream, it sends a segment with the FIN flag set. 2. The server sends an ACK to acknowledge the receipt of the FIN to terminate the session from client to server. 3. The server sends a FIN to the client, to terminate the server to client session. 4. The client responds with an ACK to acknowledge the FIN from the server.
  • 35. Byte Stream Service • To the lower layers, TCP handles data in blocks, the segments. • To the higher layers TCP handles data as a sequence of bytes and does not identify boundaries between bytes • So: Higher layers do not know about the beginning and end of segments ! TCP Application 1. write 100 bytes 2. write 20 bytes queue of bytes to be transmitted TCP queue of bytes that have been received Application 1. read 40 bytes 2. read 40 bytes 3. read 40 bytes Segments
  • 36. 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.
  • 37. TCP header fields Port Number: ◦ A port number identifies the endpoint of a connection. ◦ A pair <IP address, port number> identifies one endpoint of a connection. ◦ Two pairs <client IP address, server port number> and <server IP address, server port number> identify a TCP connection. TCP IP Applications 23 10480Ports: TCP IP Applications 7 1680 Ports:
  • 38. TCP header fields Sequence Number (SeqNo):  Sequence number is 32 bits long.  So the range of SeqNo is 0 <= SeqNo <= 232 -1  4.3 Gbyte  Each sequence number identifies a byte in the byte stream  Initial Sequence Number (ISN) of a connection is set during connection establishment for ISN ?
  • 39. TCP header fields  Acknowledgement Number (AckNo):  Acknowledgements are piggybacked, i.e., a segment from A -> B can contain an acknowledgement for a data sent in the B -> A direction  Q: Why is piggA hosts uses the AckNo field to send acknowledgements. (If a host sends an AckNo in a segment it sets the “ACK flag”)  The AckNo contains the next SeqNo that a hosts wants to receive . Example: The acknowledgement for a segment with sequence numbers 0-1500 is AckNo=1501y backing good ?
  • 40. TCP header fields Acknowledge Number (cont’d) TCP uses the sliding window flow protocol to regulate the flow of traffic from sender to receiver TCP uses the following variation of sliding window: no NACKs (Negative ACKnowledgement) only cumulative ACKs Example: Assume: Sender sends two segments with “1..1500” and “1501..3000”, but receiver only gets the second segment. In this case, the receiver cannot acknowledge the second packet. It can only send AckNo=1
  • 41. TCP header fields • Header Length ( 4bits): – Length of header in 32-bit words – Note that TCP header has variable length (with minimum 20 bytes)
  • 42. TCP header fields  Flag bits: ◦ URG: Urgent pointer is valid  If the bit is set, the following bytes contain an urgent message in the range: SeqNo <= urgent message <= SeqNo+urgent pointer ◦ ACK: Acknowledgement Number is valid ◦ PSH: PUSH Flag  Notification from sender to the receiver that the receiver should pass all data that it has to the application.  Normally set by sender when the sender’s buffer is empty
  • 43. TCP header fields  Flag bits: ◦ RST: Reset the connection  The flag causes the receiver to reset the connection  Receiver of a RST terminates the connection and indicates higher layer application about the reset ◦ SYN: Synchronize sequence numbers  Sent in the first packet when initiating a connection ◦ FIN: Sender is finished with sending  Used for closing a connection  Both sides of a connection must send a FIN
  • 44. TCP Header Fields Window Size: Each side of the connection advertises the window size Window size is the maximum number of bytes that a receiver can accept. Maximum window size is 216-1= 65535 bytes TCP Checksum: TCP checksum covers over both TCP header and TCP data (also covers some parts of the IP header) Urgent Pointer: Only valid if URG flag is set
  • 45. TCP Header Fields • Options End of Options kind=0 1 byte NOP (no operation) kind=1 1 byte Maximum Segment Size kind=2 1 byte len=4 1 byte maximum segment size 2 bytes Window Scale Factor kind=3 1 byte len=3 1 byte shift count 1 byte Timestamp kind=8 1 byte len=10 1 byte timestamp value 4 bytes timestamp echo reply 4 bytes
  • 46. TCP Header Fields Options: NOP is used to pad TCP header to multiples of 4 bytes Maximum Segment Size Window Scale Options Increases the TCP window from 16 to 32 bits, I.e., the window size is interpreted differently: What is the different interpretation ? This option can only be used in the SYN segment (first segment) during connection establishment time Timestamp Option Can be used for roundtrip measurements
  • 47. Connection Management in TCP • Opening a TCP Connection • Closing a TCP Connection • Special Scenarios • State Diagram
  • 48. TCP Connection Establishment TCP uses a three-way handshake to open a connection: (1) ACTIVE OPEN: Client sends a segment with SYN bit set * port number of client initial sequence number (ISN) of client (2) PASSIVE OPEN: Server responds with a segment with SYN bit set * initial sequence number of server ACK for ISN of client (3) Client acknowledges by sending a segment with:  ACK ISN of server (* counts as one byte)
  • 49. Three-Way Handshake aida.poly.edu mng.poly.edu SYN (SeqNo = x) SYN (SeqNo = y, AckNo = x + 1 ) (SeqNo = x+1, AckNo = y + 1 )
  • 50. TCP Connection Termination  Each end of the data flow must be shut down independently (“half-close”)  If one end is done it sends a FIN segment. This means that no more data will be sent  Four steps involved: (1) X sends a FIN to Y (active close) (2) Y ACKs the FIN, (at this time: Y can still send data to X) (3) and Y sends a FIN to X (passive close) (4) X ACKs the FIN.
  • 51. TCP States State Description CLOSED No connection is active or pending LISTEN The server is waiting for an incoming call SYN RCVD A connection request has arrived; wait for Ack SYN SENT The client has started to open a connection ESTABLISHED Normal data transfer state FIN WAIT 1 Client has said it is finished FIN WAIT 2 Server has agreed to release TIMED WAIT Wait for pending packets (“2MSL wait state”) CLOSING Both Sides have tried to close simultanesously CLOSE WAIT Server has initiated a release LAST ACK Wait for pending packets
  • 52. TCP States in “Normal” Connection Lifetime SYN (SeqNo = x) SYN (SeqNo = y, AckNo = x + 1 ) (AckNo = y + 1 ) SYN_SENT (active open) SYN_RCVD ESTABLISHED ESTABLISHED FIN_WAIT_1 (active close) LISTEN (passive open) FIN (SeqNo = m) CLOSE_WAIT (passive close) (AckNo = m+ 1 ) FIN (SeqNo = n ) (AckNo = n+1) LAST_ACK FIN_WAIT_2 TIME_WAIT CLOSED
  • 53. TCP State Transition Diagram: Opening A Connection CLOSED LISTEN SYN RCVD SYN SENT ESTABLISHED active open send: SYN recv: SYN, ACK send: ACK recv: SYN send: SYN, ACK recvd: ACK send: . / . recv: RST Application sends data send: SYN simultaneous open recv: SYN send: SYN, ACK close or timeout passive open send: . / . recvd: FIN send: FIN send: FIN
  • 54. TCP State Transition Diagram: Closing A Connection FIN_WAIT_1 FIN_WAIT_2 ESTABLISHED recv: FIN send: ACK recv: ACK send: . / . recvd: ACK send: . / . recv: FIN, ACK send: ACK active close send: FIN TIME_WAIT CLOSING recv: FIN send: ACK CLOSED Timeout (2 MSL) CLOSE_WAIT LAST_ACK passive close recv: FIN send: ACK application closes send: FIN recv: ACK send: . / .
  • 55. 2MSL(Maximum Segment Lifetime) Wait State 2MSL Wait State = TIME_WAIT When TCP does an active close, and sends the final ACK, the connection must stay in in the TIME_WAIT state for twice the maximum segment lifetime. 2MSL= 2 * Maximum Segment Lifetime Why? TCP is given a chance to resent the final ACK. (Server will timeout after sending the FIN segment and resend the FIN) The MSL is set to 2 minutes or 1 minute or 30 seconds.
  • 56. Resetting Connections • Resetting connections is done by setting the RST flag • When is the RST flag set? – Connection request arrives and no server process is waiting on the destination port – Abort (Terminate) a connection Causes the receiver to throw away buffered data. Receiver does not acknowledge the RST segment
  • 57. Flow Control • TCP also provides mechanisms for 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.
  • 58. Flow Control • 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.
  • 60. 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.
  • 61. Reducing Window Size • Another way to control the data flow • 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.
  • 62. Reducing Window Size • If a receiving host has congestion, it may respond to the sending host with a segment with a reduced window size. • In this graphic, there was a loss of one of the segments. • The receiver changed the window field in the TCP header of the returning segments in this conversation from 3000 down to 1500. • This caused the sender to reduce the window size to 1500.
  • 63. Reducing Window Size • After periods of transmission with no data losses or constrained resources, the receiver will begin to increase the window field. • This reduces the overhead on the network because fewer acknowledgments need to be sent. • Window size will continue to increase until there is data loss, which will cause the window size to be decreased. • This dynamic increasing and decreasing of window size is a continuous process in TCP, which determines the optimum window size for each TCP session.
  • 64. Reducing Window Size • In highly efficient networks, window sizes may become very large because data is not being lost. In networks where the underlying infrastructure is being stressed, the window size will likely remain small.