TCP output
Shows the process of writing data from an application process to a TCP interface.
Each TCP interface has a sending buffer. We can use the SO_SNDBUF interface option to change the buffer size.
When an application process calls write, the kernel copies all data from the buffer of the application process to the sending buffer of the Set interface. If the sending buffer of the Set interface cannot accommodate all data of the application (or the buffer of the application process is greater than the sending buffer of the Set interface, or the sending buffer of the Set interface has other data ), the application process will be suspended (sleep ). It is assumed that the set of interfaces is blocked, which is usually the default setting. The kernel will not return the data from the write system until all data in the application process buffer is copied to the sending buffer of the Set interface.
Therefore,A successful response from the write call to write a TCP set of interfaces only indicates that the buffer of the application process can be reused. It does not tell us that the Peer TCP or application process has received data.
The TCP fetch interface sends the buffer data and sends it to the peer TCP. The process is based on all the rules of TCP data transmission. The peer TCP must confirm the received data. Only when the peer ACK is received can the local TCP Delete the confirmed data in the interface sending buffer. TCP must keep data copies until peer confirmation.
UDP output
Shows the process of writing data from an application process to a UDP interface.
Note that the intermediate interface is sent to the buffer with a dotted box because it does not actually exist. The UDP set interface has the size of the sending buffer (which can be modified using the SO_SNDBUF set interface option), but it is only the maximum size of the UDP datagram written to the set interface. If an application process writes a datagram greater than the buffer size of a set of interfaces, the kernel returns an EMSGSIZE error.
Since UDP is unreliable, it does not have to save the data copy of the application process, so there is no real sending buffer. (The data of an application process is copied to the kernel buffer in some form when it is passed down along the protocol stack. However, the data link layer discards the copy after sending the data .)
The write call to write UDP sets of interfaces successfully returns the user-written datagram or the output queue of the clip that has been added to the data link layer.If the queue does not have enough space to store the datagram or a part of it, the kernel usually returns an ENOBUFS error to the application process.
SCTP output
Shows the process of writing data from an application process to a SCTP interface.
SCTP is a reliable protocol similar to TCP. Its set of interfaces also have a sending buffer. Like TCP, we can use the SO_SNDBUF set of Interface Options to change the size of the buffer.
When an application process calls write, the kernel copies all data from the buffer of the application process to the sending buffer of the Set interface. If the sending buffer of the Set interface cannot accommodate all data of the application (or the buffer of the application process is greater than the sending buffer of the Set interface, or the sending buffer of the Set interface has other data ), the application process will be suspended (sleep ). It is assumed that the set of interfaces is blocked, which is usually the default setting. The kernel will not return the data from the write system until all data in the application process buffer is copied to the sending buffer of the Set interface.
Therefore,A successful response from the write call to write a SCTP set of interfaces only indicates that the buffer of the application process can be reused. It does not tell us that the Peer SCTP or application process has received data.
SCTPThe interface sends the data in the buffer zone and sends it to the peer SCTP. The process is based on all the rules of SCTP data transmission. SCTP must wait for the SACK to delete the data from the Interface Buffer after the cumulative validation point exceeds the sent data.