The data transmission process and TCP and UDP protocols in the protocol stack

wifiwireles

Just Hatched
Data transmission process

The process of data transmission in the protocol stack:
tcpip-11.png

①application processing

First of all, the application will perform encoding processing. These encodings are equivalent to the presentation layer functions of OSI; after the encoding is converted, the mail may not be sent out immediately. This kind of management function of when to establish a communication connection and when to send data is equivalent to the session layer function of OSI.

②processing of TCP module

TCP is responsible for establishing connections, sending data, and disconnecting connections according to the instructions of the application.TCP provides reliable transmission of data sent by the application layer to the peer smoothly.In order to achieve this function, a TCP header needs to be attached to the front end of the application layer data.

③ Processing of IP module

IP combines the TCP header and TCP data transmitted by TCP as its own data, and adds its own IP header to the front end of the TCP header.After the IP packet is generated, refer to the routing control vote to determine the route or host that accepts this IP packet.

④ Processing of network interface (Ethernet driver)

IP packets transmitted from IP are data for Ethernet.Attach an Ethernet header to these data and send it for processing, and the generated Ethernet data packets will be transmitted to the receiving end through the physical layer.

⑤ Processing of network interface (Ethernet driver)

After the host receives the Ethernet packet, it first finds the MAC address from the header of the Ethernet packet to determine whether it is a packet sent to itself, and if not, discards the data.If it is a packet sent to yourself, the data type is determined from the type in the header of the Ethernet packet, and then passed to the corresponding module, such as IP, ARP, etc.The example here is IP.

⑥ Processing of IP module

The IP module does similar processing after receiving the data.Determine whether this IP address matches your own IP address from the packet header, and if it matches, send the data to the corresponding module according to the protocol type of the header, such as TCP and UDP.The example here is TCP.In addition, for the case of a router, the receiving end address is often not its own address. At this time, it is necessary to use the routing control table to investigate the host or router to which it should be sent before forwarding the data.

⑦ Processing of TCP module

In the TCP module, the checksum will first be calculated to determine whether the data has been corrupted.Then check whether the data is being received according to the serial number.Finally, check the port number to determine the specific application.After the data is completely received, it will be passed to the application identified by the port number.

⑧ Processing of applications

The receiving end application will directly receive the data sent by the sending end.By analyzing the data, the corresponding content is displayed.

04
TCP and UDP protocols

There are two representative transport layer protocols in TCP/IP: TCP and UDP.

TCP is a connection-oriented and reliable streaming protocol.Flow refers to an uninterrupted data structure. When an application uses TCP to send messages, although the order of transmission can be guaranteed, it is still sent to the receiving end as a data stream without any interval.In order to provide reliable transmission, TCP implements a “sequence control” or “resend control” mechanism.In addition, it also has many functions such as “flow control (flow control)”, “congestion control”, and improving network utilization.

UDP is a packet protocol that is not reliable.The subtle processing will be left to the upper-level application to complete.In the case of UDP, although the size of the message sent can be guaranteed, there is no guarantee that the message will arrive.Therefore, applications sometimes resend according to their own needs.

The advantages and disadvantages of TCP and UDP cannot be compared simply and absolutely: TCP is used in situations where it is necessary to achieve reliable transmission at the transport layer; on the one hand, UDP is mainly used for those communications or broadcast communications that have high requirements for high-speed transmission and real-time performance.TCP and UDP should be used on demand according to the purpose of the application.

Ebyte Electronic Technology Co., Ltd. specializes in the development and production of wireless data transmission modules with various functions in various frequency bands. The products have been widely used in the Internet of Things, consumer electronics, industrial control, medical care, security alarm, field collection, smart home, highway, property management, water and electricity meter reading, power monitoring, environmental monitoring and other application scenarios. If you have any needs, please contact email:[email protected] Or visit the website:
Please, Log in or Register to view URLs content!
 

Log in

or Log in using
Back
Top