When a user problems a command that uses a TCP/IP application layer protocol, a chain of occasions is set in motion. The user"s command or blog post passes through the TCP/IP protocol stack on the local machine, and also then across the network media to the protocols ~ above the recipient. The protocols at eachlayer on the sending out host add information to the original data.
As the user"s command makes its method through the protocol stack, protocols on every layer of the sending out host likewise interact v their peers on the receiving host. The following number shows this interaction.
You are watching: How does tcp handle data sequencing
Data Encapsulation and also the TCP/IP Protocol Stack
The packet is the straightforward unit of info transferred throughout a network, consisting, in ~ a minimum, that a header v the sending and receiving hosts" addresses, and a body v the data to be transferred. Together the packet travels through the TCP/IP protocol stack, the protocols at every layer eitheradd or remove fields from the an easy header. As soon as a protocol on the sending organize adds data come the packet header, the process is referred to as data encapsulation. Moreover, each layer has actually a different term for the altered packet, as shown in the complying with figure.Figure 4-1 how a Packet Travels v the TCP/IP Stack
This ar summarizes the life bike of a packet from the time the user issues a command or sends out a article to the time it is got by the proper application ~ above the receiving host.
Application Layer--User Initiates Communication
The packet"s history begins when a user ~ above one hold sends a message or problems a command that must accessibility a remote host. The application protocol connected with the command or message layouts the packet so that it have the right to be handled by the appropriate transport layer protocol, TCP or UDP.
Suppose the user issues an rlogin command to log in come the far host, as displayed in number 4-1. The rlogin command supplies the TCP move layer protocol. TCP expects to get data in the form of a present of bytes containing the informationin the command. Therefore, rlogin sends this data as a TCP stream.
Not all application layer protocols usage TCP, however. Suppose a user desires to mount a file system on a remote host, hence initiating the NIS+ application layer protocol. NIS+ supplies the UDP move layer protocol. Therefore, the packet include the command must be formatted in a manner the UDPexpects. This kind of packet is described as a message.
Transport Layer--Data Encapsulation Begins
When the data arrives at the transport layer, the protocols at the layer start the process of data encapsulation. The end an outcome depends on whether TCP or UDP has actually handled the information.TCP Segmentation
TCP is often called a "connection-oriented" protocol since it ensures the successful delivery of data to the receiving host. Figure 4-1 shows how the TCP protocol obtain the stream indigenous the rlogin command. TCP divides the data received from theapplication layer into segments and attaches a header to each segment.
Segment headers save sender and also recipient ports, segment bespeak information, and also a data field known as a checksum. The TCP protocols ~ above both hosts usage the checksum data to determine whether data has transferred there is no error.
See more: What Is Bane Of Arthropods In Minecraft, What Does The Bane Of Arthropods Do In Minecraft
TCP offers segments to identify whether the receiving host is ready to receive the data. Once the sending out TCP desires to develop connections, it sends a segment dubbed a SYN to the peer TCP protocol running on the receiving host. The receiving TCP return a segment referred to as an ACK to identify thesuccessful receipt of the segment. The sending TCP sends one more ACK segment, climate proceeds come send the data. This exchange of regulate information is described as a three-way handshake.UDP Packets
UDP is a "connectionless" protocol. Unlike TCP, that does not examine to make sure that data landed on the receiving host. Instead, UDP takes the message received from the application layer and also formats it right into UDP packets. UDP attaches a header to every packet, whichcontains the sending and also receiving host ports, a field with the size of the packet, and a checksum.
The sending UDP process attempts to send the packet come its peer UDP procedure on the receiving host. The applications layer determines whether the receiving UDP procedure acknowledges that the packet was received. UDP calls for no an alert of receipt. UDP go not usage the three-way handshake.
As shown in number 4-1, both TCP and also UDP pass their segments and packets under to the net layer, where they space handled through the IP protocol. IP prepares lock for distribution by formatting them into units dubbed IP datagrams. IP climate determines the IP addresses because that the datagrams,so they have the right to be delivered effectively to the receiving host.IP Datagrams
IP attaches an IP header come the segment or packet"s header in addition to the information added by TCP or UDP. Information in the IP header includes the IP addresses the the sending and receiving hosts, datagram length, and datagram succession order. This info is providedin situation the datagram exceeds the allowable byte size for network packets and also must it is in fragmented.
Data-Link Layer--Framing takes Place
Data-link layer protocols, such as PPP, format the IP datagram right into a frame. They connect a third header and a footer to "frame" the datagram. The structure header has a cyclical redundancy check (CRC) field that checks for errors as the frametravels end the network media. Then the data-link layer overcome the framework to the physical layer.
Physical Network Layer--Preparing the framework for Transmission
The physics network great on the sending hold receives the frames and also converts the IP addresses right into the hardware addresses ideal to the network media. The physics network layer then sends the structure out end the network media.
How the Receiving organize Handles the Packet
When the packet arrives on the receiving host, it travels with the TCP/IP protocol stack in the reverse order from that which it take it on the sender. Number 4-1 illustrates this path. Moreover, each protocol top top the receiving organize strips turn off header details attached to thepacket by its peer ~ above the sending host. Here is what happens:
TCP/IP inner Trace Support
TCP/IP provides internal trace support by logging TCP interaction when a connection is terminated by an RST packet. As soon as an RST packet is transmitted or received, details on as many as 10 packets, which to be transmitted or received instantly before on the connection, is logged through theconnection information.