Common Transport protocols: UDP , TCP
UDP protocol:
Features:
1. Encapsulate the data and the source and destination into a packet, no need to establish a connection
2. Limit the size of each packet within 64K
3. Due to no connection, it is an unreliable agreement
4. No need to establish a connection, fast
For example, if you send a parcel to your home, it will be sent regardless of whether someone is at home at this time. when the courier is sent to your home, if someone, the family received the package, if no one at home at this time, the package (packet) was discarded.
Self-Understanding:
When we established the connection, you said: "Have you eaten?" "And then you don't care whether she hears it or not, you continue to say the second sentence:" How about playing table tennis in the afternoon? ”。 As there is no certainty that the other person hears what you have just said, there are four possible situations:
The first situation: she heard both words, and then replied: "After dinner, you can play together." ".
The second situation: she only heard the first sentence, so only replied: "Eaten!" "But will not answer whether you can play together."
The third situation: she only heard the second sentence, so only answer: "Can play together!" "But I won't answer if you have eaten."
Fourth situation: She didn't hear two words, so she won't answer any of your words.
This is the non-connected UDP protocol for the transport layer.
TCP protocol:
Characteristics:
1. Establish a connection to form a channel for transmitting data.
2. Make large data transfers in the connection.
3. Complete the connection via three handshakes, which is a reliable protocol.
4. Must establish a connection, the efficiency will be slightly lower
Classic examples:
1. Download the file.
2. Call.
Self-Understanding:
When we established the connection, you said: "Have you eaten?" And then you say nothing and wait for her answer. When she tells you she hears what you say, and answers you: "Eaten." "Then you start to say the second sentence:" How about playing table tennis in the afternoon? " then you say nothing and wait for her answer. When she tells you she hears what you say, and answers you: "Can play together!" "You tell her you heard her answer, and then the call terminates!"
This is the TCP protocol for the three-time handshake of the transmission plane to the connection.
TCP three-time handshake plot:
The TCP/UDP of 4.Java network programming