0% found this document useful (0 votes)
27 views

TCP Segment: 0 4 Source Port 16 10

The TCP segment header consists of 20 bytes with fields for source and destination ports, sequence numbers, acknowledgment numbers, header length, flags, window size, checksum, and urgent pointers. It may also contain optional fields. The sequence numbers identify the position of data in the byte streams from each end point. The acknowledgment numbers indicate bytes that have been received. Flags control data flow and error handling. The checksum detects errors in the segment.

Uploaded by

vomawew647
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

TCP Segment: 0 4 Source Port 16 10

The TCP segment header consists of 20 bytes with fields for source and destination ports, sequence numbers, acknowledgment numbers, header length, flags, window size, checksum, and urgent pointers. It may also contain optional fields. The sequence numbers identify the position of data in the byte streams from each end point. The acknowledgment numbers indicate bytes that have been received. Flags control data flow and error handling. The checksum detects errors in the segment.

Uploaded by

vomawew647
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

TCP SEGMENT

0 4
10 16 24 31
Source port
Destination port
Sequence number

Acknowledgment number
Header
length

U A P R S F
R C S S Y I
G K H T N N
Reserved
Window size
Checksum
Urgent pointer
Options

Padding
Data

FIGURE 4.20 TCP segment

Figure 8.20 shows the format of the TCP segment. The header
consists of a 20 The description of each field in the TCP segment
is given below. The term sender refers to the host that sends the
segment, and receiver refers to the host that receives the segment.
Source port and destination port: The source and destination
ports identify the sending and receiving applications, respectively.
Recall from section 2.3.1 that the pair of ports and IP addresses
identify a process-to-process connection. byte fixed part plus a
variable-size options field.
Sequence number: The 32-bit sequence number field identifies
the position of the first data byte of this segment in the sender's
byte stream during data transfer (when SYN bit is not set). The
sequence number wraps back to 0 after 232 1. Note that TCP
identifies the sequence number for each byte (rather than for each
segment). For example, if the value of the sequence number is 100
and the data area contains five bytes, then the next time this
TCP module sends a segment, the sequence number will be
105. If the SYN bit is set to 1 (during connection establishment),
the sequence number indicates the initial sequence number (ISN)
to be used in the sender's byte stream. The sequence number of
the first byte of data for this byte stream will be ISN+1. It is
important to note that a TCP connection is full duplex so that each
end point independently maintains its own sequence number.
Acknowledgment number: This field identifies the sequence
number of the next data byte that the sender expects to receive if
the ACK bit is set. This field also indicates that the sender has
successfully received all data up to but not including this value. If
the ACK bit is not set (during connection establishment), this field
is meaningless. Once a connection is established, the ACK bit
must be set.
Header length: This field specifies the length of the TCP
header in 32-bit words. This information allows the receiver to
know the beginning of the data area because the options field is
variable length.
Reserved: As the name implies, this field is reserved for future
use and must be set to 0.
URG: If this bit is set, the urgent pointer is valid (discussed
shortly).
ACK: If this bit is set, the acknowledgment number is valid.
PSH: When this bit is set, it tells the receiving TCP module to
pass the data to the application immediately. Otherwise, the
receiving TCP module may choose to buffer the segment until
enough data accumulates in its buffer.
RST: When this bit is set, it tells the receiving TCP module
to abort the connection because of some abnormal condition.
SYN: This bit requests a connection (discussed later).
FIN: When this bit is set, it tells the receiver that the sender
does not have any more data to send. The sender can still
receive data from the other direction until it receives a segment
with the FIN bit set.
Window size: The window size field specifies the number of bytes
the sender is willing to accept. This field can be used to control
the flow of data and congestion.
Checksum: This field detects errors on the TCP segment. The
procedure is discussed below.
Urgent pointer: When the URG bit is set, the value in the
urgent pointer field added to that in the sequence number field
points to the last byte of the ``urgent data'' (data that needs
immediate delivery). However, the first byte of the urgent data
is never explicitly defined. Because the receiver's TCP module
passes data to the application in sequence, any data in the
receiver's buffer up to the last byte of the urgent data may be
considered urgent.
Options: The options field may be used to provide other
functions that are not covered by the header. If the length of the
options field is not a multiple of 32 bits, extra padding bits will be
added. The most important option is used by the sender to
indicate the maximum segment size (MSS) it can accept. This
option is specified during connection setup. Two other options
that are negotiated during connection setup are intended to deal
with situations that involve large delay-bandwidth products. The
window scale option allows the use of a larger advertised window
size. The window can be scaled upward by a factor of up to 214.
Normally the maximum window size is 216 1 ˆ 65,535. With
scaling the maximum advertised window size is 65,535 214 fl
1,073,725,440 bytes. The timestamp option is intended for high-
speed connections where the sequence numbers may wrap
around during the lifetime of the connection. The timestamp
option allows the sender to include a timestamp in every segment.
This timestamp can also be used in the RTT calculation.

TCP CHECKSUM
The purpose of the TCP checksum field is to detect errors. The
checksum com putation procedure is similar to that used to
compute an IP checksum (discussed in Chapter 3) except for two
features. First, if the length of the segment is not a multiple of 16
bits, the segment will be padded with zeros to make it a multiple
of 16 bits. In doing so, the TCP length field is not modified.
Second, a pseudoheader (shown in Figure 8.21) is added to the
beginning of the segment when performing the checksum
computation.
0 8 16
31

Source IP address

Destination IP address

00000000 Protocol fl 6 TCP segment


length

FIGURE 4.21 TCP pseudoheader

Source : http://elearningatria.files.wordpress.com/2013/10/cse-vi-computer-
networks-ii-10cs64-notes.pdf

You might also like