Transport Layer Learning (transport layer, UDP)

Source: Internet
Author: User

One of transport layer learning (transport layer, UDP) transport layer is located between the network layer and the application layer. It aims to support communication between processes running on different hosts. The Transport Layer extends the communication services between different hosts at the network layer to processes running on different hosts. 1. Transport Layer Protocol provides logical communication between applications running on different hosts, while the network layer provides logical communication services between hosts .. The Transport Layer runs on the host, that is, the terminal system. The basic communication process is Sender: the transport layer receives packets from application processes and converts them to transport layer groups, which are called transport layer packet segments on the Internet, the Transport Layer then delivers the group to the network layer and the network layer delivers it to the target host. Receiver: the network layer extracts the transport layer packet segment from the data and submits it to the transport layer. 1. the link between the transport layer and the network layer is built on the network layer. Therefore, the services provided by the transport layer must be limited by the services provided by the network layer. For example, if the network layer cannot provide bandwidth and latency assurance, the transport layer cannot provide this service. However, the transport layer can still provide services not provided by the network layer. For example, the IP layer is unreliable, but the transport layer can still provide reliable services. 2. transport Layer overview TCP/IP provides three transport layer protocols: UDP: User Datagram Protocol, which provides applications with an unreliable connectionless service TCP: Transport Control Protocol, it provides applications with a reliable ground-to-ground connection service SCTP: traffic control transmission protocol, which provides applications with a reliable ground-to-ground connection service. It provides stable and ordered data transmission services (similar to TCP) between two endpoints, and can protect data message boundaries (such as UDP ). However, unlike TCP and UDP, SCTP supports Multi-host and Multi-streaming ). The basic task of the transport layer is to extend the communication service between different hosts provided by the network layer to processes running on different hosts. This extension is called the multiplexing and multiplexing of the transport layer. The transport layer uses socket to provide multiplexing and multiplexing. 2. UDPUDP is a simple datagram-oriented transport layer protocol. Each output operation of a process generates a UDP datagram and assembles it into an IP datagram to be sent. Therefore, if the application uses UDP for implementation, the application is almost directly dealing with IP addresses. UDP only provides very limited services on the network layer: inter-process data delivery and error detection. 1. the multiplexing and multiplexing transport layer of UDP provides multiplexing and multiplexing through socket, and: each socket has a unique identifier. Each packet segment has a special field to indicate the socket to be delivered, the source port number and the destination port number indicate that the port number of this special field is a 16-bit number, and its size is between 0 and 65536. The port number between 0 and 1023 is a well-known port number, and its use is restricted (meaning it cannot be used at will ). The basic process of multiplexing and multiplexing at the transport layer is: the process on the host creates a socket and requests a port number for it, assume that process A created A socket on host host1 and applied to port 10000, process B on host host2 creates A socket and requests process A on host host1 on port 20000 to communicate with process B on host host2, therefore, it sends a datagram from its associated socket and sets the source port to 10000 and the destination port to 20000, then, the datagram is submitted to the network layer and sent to host B by the network layer. When the network layer of host B receives the packet, it submits the data on the transport layer to the transport layer. Then, the transport layer checks the destination port of the datagram and finds that the packet is 20000, then, the datagram is submitted to the socket associated with port 20000, and then submitted to process B. UDP basically works in this mode. Therefore, UDP only provides the most basic services required by the transport layer. It can be seen from the above that the port number plays an extremely important role in the work of the transport layer. In practice, the typical situation is that the client allows the transport layer to automatically allocate the port number, while the server uses the well-known port number, this is also an important reason for the port numbers between 0 and 1023 to be retained. In this way, the port numbers of well-known services are fixed. For UDP, UDP socket is identified by the Binary Group of the destination IP address and destination port number. Therefore, if two UDP datagram messages have different source IP addresses and source ports but have the same destination IP address and destination port, they will be submitted to the same process through the same socket. In UDP, The Source Port aims to be a part of the "return address. In a typical client and server model, because the client port number is unknown in advance, the server must obtain the client port number from the datagram sent from the client to the server, this port number is used for the destination port domain when the server sends a datagram to the client. 2. UDP datagram format: The UDP Header Format is as follows: the port number is used to identify the sending and receiving processes. The UDP length field refers to the byte length of the UDP header and UDP data. UDP checks and overwrites UDP header and UDP data. UDP checks are optional. Although they are optional, they should always be used. UDP checksum: first, the UDP datagram length can be an odd number of bytes, but the test algorithm adds several 16-bit characters. The solution is to add the padding byte 0 at the end when necessary, just for testing and calculation (the increased padding byte may not be transferred ). Secondly, UDP datagram contains a 12-byte long pseudo header, which is set for calculation check and. The pseudo header contains some IP header fields. The purpose is to let UDP check whether the data has arrived at the destination correctly twice. The pseudo-Header Format in UDP datagram: the length of UDP datagram appears twice during the test and calculation. If the test result is 0, the saved value is 1 (65535 ). If the transfer check is 0, it indicates that the sending end has no calculation check.
UDP test is an end-to-end test. It is calculated by the sender and then verified by the receiver. The aim is to find any changes made between the UDP header and the data sending end and the receiving end. This is the error detection service provided by UDP and one of the two services provided by UDP.
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.