Daily Java side (Part1: computer network) [19/10/21]

Author: The story I forgot ¢
personal micro-channel public number: program ape fight with

1.UDP Profile

1.1UDP message structure:

image

Source Port: Source Port

Destination Port: Destination Port

Length: Packet length

Checksum: parity value

data octets: user data

1.2 UDP Features

1. The non-connection-oriented

Before transmitting data, and a source terminal without establishing a connection, when he wants to transmit, it simply to fetch data from the application, as soon as possible and to put him into the network, the transmission section, UDP data transfer speed, the speed is only affected application generates data and the capabilities of the computer bandwidth limitations. at the receiving end, UDP segment to each message in a queue, each time an application to read a message from the queue segment.

  1. Does not maintain the connected state, supports simultaneous transmission of multiple clients to the same message

  2. Packet header is only 8 bytes, less overhead

  3. Restricted to only certain data generation rate, the transmission rate and performance of the machine

  4. Best effort delivery, does not guarantee reliable delivery, no need to maintain complex link state table

  5. Message-oriented, message information submitted when the application does not split or merged, and therefore, the application should select the appropriate size of the packet

2. TCP and UDP difference

  1. Connection-oriented TCP, UDP non-connection-oriented

  2. Reliability: TCP is more reliable, use handshake, acknowledgment and retransmission mechanisms to provide reliability, UDP may be lost
  3. Ordering: TCP orderly, using the TCP sequence numbers to ensure that the sequence of the interactions of Izvestia, may arrive out of order, but TCP will eventually sort, but UDP does not have the orderliness
  4. Speed: TCP slow, because you want to create a connection, and ordered to ensure the reliability of the message, UDP is more suitable for speed sensitive applications, such as online video media, television broadcasting, online multiplayer games
  5. The order of: TCP heavyweight belongs, belongs lightweight UDP, header size is reflected in the source data, TCP is 20 bytes, and 8 bytes of UDP

Guess you like

Origin www.cnblogs.com/jsccc520/p/11717163.html