When a user worries a command that offers a TCP/IP application layer protocol, a chain of occasions is collection in motion. The user"s command or blog post passes v the TCP/IP protocol ridge on the neighborhood machine, and then throughout the network media to the protocols on the recipient. The protocols at eachlayer on the sending host add information come the original data.

As the user"s command makes its means through the protocol stack, protocols on every layer of the sending out host also interact v their partner on the receiving host. The following number shows this interaction.

You are watching: How does tcp handle data sequencing

Data Encapsulation and the TCP/IP Protocol Stack

The packet is the simple unit of details transferred throughout a network, consisting, in ~ a minimum, that a header with the sending and receiving hosts" addresses, and also a body through the data to be transferred. Together the packet travels with the TCP/IP protocol stack, the protocols at each layer eitheradd or remove areas from the basic header. When a protocol on the sending host adds data come the packet header, the procedure is referred to as data encapsulation. Moreover, each layer has actually a various term because that the changed packet, as presented in the complying with figure.

Figure 4-1 just how a Packet Travels through the TCP/IP Stack
*

This section summarizes the life cycle of a packet from the time the user issues a command or sends a blog post to the time it is received by the proper application on the receiving host.

Application Layer--User Initiates Communication

The packet"s background begins when a user on one hold sends a message or worries a command the must access a far host. The application protocol connected with the command or message styles the packet so the it can be tackled by the ideal transport layer protocol, TCP or UDP.

Suppose the user problems an rlogin command to log in come the remote host, as shown in number 4-1. The rlogin command offers the TCP deliver layer protocol. TCP expects to receive data in the type of a present of bytes include the informationin the command. Therefore, rlogin sends this data as a TCP stream.

Not all applications layer protocols usage TCP, however. Mean a user wants to mount a document system ~ above a far host, for this reason initiating the NIS+ applications layer protocol. NIS+ supplies the UDP carry layer protocol. Therefore, the packet containing the command have to be formatted in a manner the UDPexpects. This kind of packet is described as a message.

Transport Layer--Data Encapsulation Begins

When the data come at the transport layer, the protocols in ~ the layer start the process of data encapsulation. The end an outcome depends on even if it is TCP or UDP has handled the information.

TCP Segmentation

TCP is often called a "connection-oriented" protocol because it ensures the successful delivery of data to the receiving host. Number 4-1 shows just how the TCP protocol obtain the stream native the rlogin command. TCP divides the data obtained from theapplication layer into segments and attaches a header to every segment.

Segment headers save on computer sender and recipient ports, segment notified information, and also a data ar known as a checksum. The TCP protocols top top both hosts usage the checksum data to identify whether data has transferred without error.

See more: Dna And Rna Are Polymers Composed Of Nucleotides, Structure Of Nucleic Acids

Establishing a TCP Connection

TCP supplies segments to determine whether the receiving host is prepared to obtain the data. Once the sending TCP desires to create connections, it sends out a segment dubbed a SYN to the peer TCP protocol running on the receiving host. The receiving TCP return a segment called an ACK to acknowledge thesuccessful receipt the the segment. The sending TCP sends one more ACK segment, climate proceeds to send the data. This exchange of control information is referred to as a three-way handshake.

UDP Packets

UDP is a "connectionless" protocol. Unlike TCP, the does not examine to make sure that data arrived on the receiving host. Instead, UDP bring away the message received native the applications layer and also formats it right into UDP packets. UDP attaches a header to each packet, whichcontains the sending and also receiving organize ports, a ar with the size of the packet, and a checksum.

The sending out UDP procedure attempts to send the packet come its peer UDP process on the receiving host. The application layer determines even if it is the receiving UDP procedure acknowledges the the packet was received. UDP requires no notification of receipt. UDP go not use the three-way handshake.

Internet Layer

As presented in number 4-1, both TCP and UDP happen their segments and also packets down to the web layer, whereby they are handled by the IP protocol. IP prepares castle for shipment by formatting them into units called IP datagrams. IP climate determines the IP addresses for the datagrams,so they can be delivered effectively come the receiving host.

IP Datagrams

IP attaches one IP header to the segment or packet"s header in addition to the information added by TCP or UDP. Information in the IP header has the IP addresses of the sending and receiving hosts, datagram length, and datagram sequence order. This info is providedin situation the datagram exceeds the allowable byte dimension for network packets and must be fragmented.

Data-Link Layer--Framing take away Place

Data-link class protocols, such as PPP, style the IP datagram into a frame. They affix a third header and also a footer to "frame" the datagram. The structure header consists of a cyclical redundancy check (CRC) ar that checks because that errors as the frametravels end the network media. Then the data-link layer passes the structure to the physics layer.

Physical Network Layer--Preparing the frame for Transmission

The physics network layer on the sending hold receives the frames and converts the IP addresses right into the hardware addresses appropriate to the network media. The physics network class then sends out the frame out end the network media.

How the Receiving organize Handles the Packet

When the packet arrives on the receiving host, it travels v the TCP/IP protocol ridge in the reverse order from that which it took on the sender. Number 4-1 illustrates this path. Moreover, every protocol top top the receiving host strips turn off header information attached to thepacket by its peer ~ above the sending out host. Below is what happens:

TCP/IP internal Trace Support

TCP/IP provides internal trace assistance by logging TCP interaction when a link is terminated by one RST packet. When an RST packet istransfer or received, information on as countless as 10 packets, which to be transmitted or received instantly before on the connection, is logged through theconnection information.