The document provides an overview of TCP (Transmission Control Protocol) features and the TCP header. It discusses the role of the transport layer in allowing communication between endpoints, and how TCP provides reliable data transport. The structure of the TCP header is explained in detail, including the source/destination ports, sequence/acknowledgment numbers, flags, window size, checksum and options. Quiz questions are also provided to test understanding.
2. Recap
In the previous class, you have learnt about
• Different layers of TCP/IP
2
3. Objectives
On completion of this period, you would be able to know
about
• Understand the features of TCP
• Structure of the TCP Header
• Importance of primitives used and transport entities
3
4. What is the role of a Transport Layer ?
• It is designed to allow peer entities on the source and
destination hosts to carry on a conversation
• It acts as an interface between the lower layers and the
upper layers
4
5. Transport Layer contd…
• Transport layer is the heart of the TCP/IP Network
architecture
• Its task is to provide reliable data transport from the source
machine to the destination machine
• It is done independent of the networks currently used
• It provides certain services to the upper layers
5
6. Transport Layer contd…
HOST 1 HOST 2
Application
Application
(or session) layer
Transport (or session) layer
Application/transport
address
interface
TPDU
Transport Transport
entity Transport entity
protocol
Transport/ Application
Network
interface
address
Network layer
Network layer
Fig .1
6
7. Transport Layer contd…
• The hardware and software within the transport layer is
called transport entity
• Transport entity can be located in the operating system
kernel
• Transport entity can be located in a separate user
process, in a library package or on the network interface
card
• The previous figure explains the relationship of the
network, transport and application layers
• The transport protocol carries TPDU between transport
entity of host1 to host2
7
8. Transport Layer contd…
• The layers below the transport layer are concerned with
packaging, addressing, routing and delivery of data
• The physical layer handles the bits
• The data link layer deals with local networks
• Network layer handles routing between networks
• The transport layer depends on the lower layers to
handle the process of moving data between systems
• The transport layer acts as a interface between the
applications at the higher layers and the functions of the
lower layers 8
9. Transport Layer contd…
• The modern computers are multi tasking and may have
several applications trying to send and receive data
• The transport layer should provide a means by which
these applications can send or receive data
• The transport layer is responsible for end-to-end or host-
to-host transport
• In the TCP/IP model it is called host-to-host transport
layer
9
10. Types of Transport Services
There are two types of transport services
• The connection oriented transport service
• Connectionless oriented transport service
They both have three phases
• Establishment of connection
• Data transfer using the connection
• Releasing the connection
10
11. Transport Protocol
• The transport service is implemented by a transport
protocol used between two transport entities
• Transport protocols have to deal with error control,
sequencing and flow control
• At the data link layer two routers communicate directly
via physical channel
11
13. The TCP Segment Header
• In the previous figure we have seen the TCP Header
Layout. Let us see its details
• Every Segment begins with a fixed format, 20-byte
header
• The fixed header may be followed by header options
• After the options, if any, up to 65,535 – 20 = 65,515 the
20 bytes subtracted belong to the IP header
13
14. The TCP Segment Header
• 65.515 – 20 = 65,495 now the 20 bytes subtracted
belong to the TCP header
• A maximum of 65,495 data bytes can be the Payload i.e.
data to be transferred
• If there is no data also TCP header can be send but
commonly used for acknowledgements and control
messages
14
15. The TCP Segment Header
contd….
• Let us study the TCP header field by field
• The Source port and Destination port fields identify the
local end points of the connection
• The well-known ports are defined at www.iana.org each
host can allocate the port address as he wishes
• A port plus its host’s IP address forms a 48-bit unique
end point
• The source and destination end points together identify
the connection
15
16. The TCP Segment Header Continued
• The Sequence number and Acknowledgement number
fields perform their usual functions
• Note that the latter specifies the next byte expected, not
the last byte correctly received
16
17. The TCP Segment Header Continued
• Both are 32 bits long because every byte of data is
numbered in a TCP stream
• The TCP header length tells how many 32-bit words are
contained in the TCP header
• This information is needed because the Options field is
of variable length, so is the header
17
18. The TCP Segment Header Continued
UR ACK PSH RST SYN FIN
G
6-bit field
• This field has been used for the last 25 years which tells
us that it has been perfectly structured
• It has six 1-bit flags
• URG is set to 1 if the Urgent pointer is in use
• The Urgent pointer is used to indicate a byte offset from
the current sequence number at which urgent data are to
be found
18
19. The TCP Segment Header Continued
• The ACK bit is set to 1 to indicate that Acknowledgement
number is valid
• If ACK is 0, the segment does not contain an
acknowledgement so that the Acknowledgement number
field is ignored
• The PSH bit indicates PUSHED data. The receiver is
hereby kindly requested to deliver the data to the
application upon arrival
19
20. The TCP Segment Header Continued
• It should not buffer it until a full buffer has been received
• The RST bit is used to reset a connection that has
become confused due to a host crash or some other
reason
• It is also used to reject an invalid segment or refuse an
attempt to open a connection
• In general, if you get a segment with RST bit ON, you
have a problem on your hands
20
21. The TCP Segment Header Continued
• The SYN bit is used to establish connections. The
connection request has SYN=1 and ACK=0 it means
acknowledgement field is not in use
• If the connection reply does bear an acknowledgement,
it has SYN=1 and ACK=1
• In essence the SYN bit is used to denote CONNECTION
REQUEST and CONNECTION ACCEPTED, with the
ACK bit used to distinguish between those two
possibilities
21
22. The TCP Segment Header Continued
• The FIN bit is used to release a connection
• It specifies that the sender has no more data to transmit
• However, after closing a connection, the closing process
may continue to receive data indefinitely
• Both SYN and FIN segments have sequence numbers
and are thus guaranteed to be processed in the correct
order
22
23. The TCP Segment Header Continued
Window Size
• Flow control in TCP is handled using a variable-sized
sliding window
• The Window size field tell how many bytes may be sent
starting at the byte acknowledged
• A window size field of 0 is legal and says that the bytes
up to and including Acknowledgement number-1 have
been received
23
24. The TCP Segment Header
Continued
Checksum
• A Checksum is also provided for extra reliability
• It Checksums the header and data
• The Checksum is added which can be used for error
detection
• When the header, data bytes are added along with the
16-bit checksum at the receiving system
• If the result obtained is zero then there is no error
• If the result is not zero the receiving system asks for a
retransmission of frame
24
25. Summary
In this class, you have learnt about
• Functions of Transport layer of TCP/IP
• Structure of the TCP Header and its description
• Importance of primitives used and transport entities
25
26. Quiz
1) The protocol used in the transport layer
a) IP
b) Telnet
c) TCP
d) None
26
27. Quiz
2. The size of the TCP Header or IP header is
a) 40 bytes
b) 20 bytes
c) 65,535
d) 65,495
27
28. Quiz
3) How many 1 bit field is present in the TCP
header
a) 5
b) 6
c) 7
d) 8
28
29. Quiz
4) If the data bytes = 0 in a TCP header it is a
a) acknowledgement frame
b) control frame
c) data frame
d) none of the above
29
30. Frequently Asked Questions
Short Questions
1. Draw the structure of the TCP Header?
2. What are the various primitives used in the transport
layer ?
3. Briefly describe the data transfer between two
transport entities
30
31. Frequently Asked Questions
Essay Questions
1. Explain the various functions of the transport layer in
TCP?
2. Draw the structure of TCP Header and describe it in
detail?
31