Layer 5 network architecture

  • Application layer: HTTP FTP
  • Transport layer: TCP (byte stream oriented, connection-oriented) UDP (connectionless) Bottom layer based on socket implementation
  • Network layer: IP
  • Data link layer: switch router
  • Physical layer: Network cables for nics

SOCKET

TCP implements two socket objects and UDP only one because of full-duplex transmission

TCP is a means of reliable transport at the transport layer

  • Sliding Windows, congestion control: Dynamically adapt to the recipient’s window buffer size by constantly trying to match the maximum traffic
  • Timeout retransmission: If the sender does not receive an ACK from the receiver within a period of time, the sender actively retransmits the ack
  • Cumulative acknowledgement: After a certain number of packets have been accumulated, the sender is told that all data prior to this packet has been received
  • Selection confirmation: Each message segment requires two boundaries (header and tail) for identification
  • Continuous ARQ: packets are sent consecutively and confirmed consecutively

Stick the TCP package

  • In academia, there is no such thing as a sticky bag
  • Sticky packets refer to that TCP is a byte stream oriented protocol and does not care about the specific content of the stream. Therefore, there may be a data stream in which the first part and the last part belong to two different applications
  • Unpack: Unpack the front and back parts of the content and distribute it to different upper-layer applications
  • Application layer protocols in the market, such as HTTP and FTP, have complete methods to handle this problem. This problem occurs only when you implement a set of private application layer protocols
  • Example workaround: by adding a special end flag to the stream, a trailing zero, and a content length flag to the header