Which transmission control protocol (tcp) flag is used to make sure the receiving end knows how to examine the sequence number field

TCP (Transmission Control Protocol) is a reliable transport protocol as it establishes a connection before sending any data and everything that it sends is acknowledged by the receiver. In this lesson we will take a closer look at the TCP header and its different fields. Here’s what it looks like:

Which transmission control protocol (tcp) flag is used to make sure the receiving end knows how to examine the sequence number field

Let’s walk through all these fields:

  • Source port: this is a 16 bit field that specifies the port number of the sender.
  • Destination port: this is a 16 bit field that specifies the port number of the receiver.
  • Sequence number: the sequence number is a 32 bit field that indicates how much data is sent during the TCP session. When you establish a new TCP connection (3 way handshake) then the initial sequence number is a random 32 bit value. The receiver will use this sequence number and sends back an acknowledgment. Protocol analyzers like wireshark will often use a relative sequence number of 0 since it’s easier to read than some high random number.
  • Acknowledgment number: this 32 bit field is used by the receiver to request the next TCP segment. This value will be the sequence number incremented by 1.
  • DO: this is the 4 bit data offset field, also known as the header length. It indicates the length of the TCP header so that we know where the actual data begins.
  • RSV: these are 3 bits for the reserved field. They are unused and are always set to 0.
  • Flags: there are 9 bits for flags, we also call them control bits. We use them to establish connections, send data and terminate connections:
    • URG: urgent pointer. When this bit is set, the data should be treated as priority over other data.
    • ACK: used for the acknowledgment.
    • PSH: this is the push function. This tells an application that the data should be transmitted immediately and that we don’t want to wait to fill the entire TCP segment.
    • RST: this resets the connection, when you receive this you have to terminate the connection right away. This is only used when there are unrecoverable errors and it’s not a normal way to finish the TCP connection.
    • SYN: we use this for the initial three way handshake and it’s used to set the initial sequence number.
    • FIN: this finish bit is used to end the TCP connection. TCP is full duplex so both parties will have to use the FIN bit to end the connection. This is the normal method how we end an connection.
  • Window: the 16 bit window field specifies how many bytes the receiver is willing to receive. It is used so the receiver can tell the sender that it would like to receive more data than what it is currently receiving. It does so by specifying the number of bytes beyond the sequence number in the acknowledgment field.
  • Checksum: 16 bits are used for a checksum to check if the TCP header is OK or not.
  • Urgent pointer: these 16 bits are used when the URG bit has been set, the urgent pointer is used to indicate where the urgent data ends.
  • Options: this field is optional and can be anywhere between 0 and 320 bits.

To see these fields in action, it’s best to play around with wireshark. Here’s an example of the first part of the TCP three way handshake. I highlighted all the fields:

Which transmission control protocol (tcp) flag is used to make sure the receiving end knows how to examine the sequence number field

Above you can see the source and destination port. The sequence number is 0 but wireshark tells us that this is a relative sequence number. In reality, it’s something else. You can see the SYN bit has been set in the flags, the window size, checksum, urgent pointer and options.

TCP is a complex protocol but hopefully this lesson has helped to understand what the TCP header looks like. If you have any questions, feel free to leave a comment in our forum.

Latest Submission Grade: 85.71%


Question 1

If a TCP socket is ready and listening for incoming connections, it's in the ______ state.

  • ESTABLISHED
  • CLOSE_WAIT
  • SYN_SENT
  • LISTEN

The LISTEN state means that a port is waiting for something to connect to it.


Question 2

The instantiation of an endpoint in a potential TCP connection is known as a ______.

  • socket
  • port
  • sequence number
  • TCP segment

A socket connects the networking stack of an operating system to applications.


Question 3

HTTP is an example of a(n) ______ layer protocol.

  • transport
  • data-link
  • application
  • network

There are lots of application layer protocols, but HTTP is one of the most common ones.


Question 4

Application layer data lives in the _____ section of the transport layer protocol.

  • data payload
  • header
  • footer
  • flags

The payload section of one layer contains the content of the layer above it.


Question 5

How many bits are used to direct traffic to specific services running on a networked computer?

A port is a 16-bit number that's used to direct traffic to specific services running on a networked computer.


Question 6

The transport layer handles multiplexing and demultiplexing through what type of device?

  • Hubs
  • Switches
  • Routers
  • Ports

The transport layer handles multiplexing and demultiplexing through ports.


Question 7

What port does the File Transfer Protocol (FTP) typically listen on?

FTP typically listens on port 21.


Question 8

Which field in a Transmission Control Protocol (TCP) header is chosen from ephemeral ports?

  • Acknowledgement number
  • Source port
  • Destination port
  • Sequence number

A source port is a high-numbered port chosen from a special section of ports known as ephemeral ports.


Question 9

Which field in a Transmission Control Protocol (TCP) header is not typically used in modern networking?

  • Sequence number
  • Acknowledgement number
  • Checksum
  • Urgent pointer

The urgent pointer field is not typically used in modern networking. This field points out particular segments that might be more important than others, but is a feature of TCP that hasn't really ever been adopted.


Question 10

The checksum doesn't compute for a packet sent at the Internet Protocol (IP) level. What will happen to the data?

  • The data will be sent back to the sending node with an error.
  • The data will be discarded.
  • The data will be resent.
  • It will be sent, but may be out of order.

At the IP or ethernet level, if a checksum doesn't compute, all of the data is just discarded. It's up to TCP to determine when to resend this data.


Question 11

Connection-oriented protocols protect against dropped data by forming connections and using what type of constant stream?

  • Verifiers
  • Approvals
  • Checks
  • Acknowledgements

Sequence numbers allow the data to be put back together in the correct order.


Question 12

In which scenario should you use the User Datagram Protocol (UDP)?

  • When you are using instant messaging with a co-worker
  • When you are sending an email
  • When you are streaming a video
  • When you make a phone call

Streaming a video through a connectionless protocol, such as UDP, will require less traffic, which will provide a faster connection.


Question 13

You are sending a very small amount of information that you need the listening program to respond to immediately. Which Transmission Control Protocol (TCP) flag will be used?

The PSH flag will be used to push the information immediately.


Question 14

Which Transmission Control Protocol (TCP) flag is used to make sure the receiving end knows how to examine the sequence number field?

The SYN flag is used to make sure the receiving end knows how to examine the sequence number field.