Dark Horse Programmer _ Bi Xiangdong _java Basic Video tutorial 23rd Day -03-Network programming (network model) Learning notes
In the last blog post we mentioned the need to pass information on computers and Computers The three elements in network communication:IP, Port, protocol. However, the transmission of information between computer and computer is not so simple, and the network in the transmission process of each transmission level corresponding function is different, so there is a hierarchical division. Originally classified as the OSI seven-layer model, later grandfather ARPANET of the computer network and its successor to the Internet used another reference Model--TCP/IP Reference model.
IP protocol:
If we want to communicate with a computer on the Internet, first of all we need to consider how to establish a connection with each other, we intend to use wired fiber to connect? or through a landline or mobile phone? This is what the data link layer and the physical layer are going to do. Who do you intend to communicate with after establishing the connection? If it is a mobile phone, do you need to dial a mobile phone number? But if it's a computer, who do you want to talk to and how to be sure? At this point you need to use the Internet Layer IP protocol to distinguish which IP is who, so you can accurately and you want to chat with the person to chat.
UDP protocol:
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:
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:
Send data from Host 1 to host 2, first through
Dynamic Demo:
The above content for personal understanding, if there is not the place also ask your predecessors to help point out!
Appendix:
About the professional interpretation of TCP/IP, recommended "a block" predecessors of several blog posts.
TCP/IP Detailed learning notes (1)-Basic ConceptsTCP/IP Detailed learning notes (2)-Data link layerTCP/IP Detailed learning notes (3)-IP Protocol, ARP protocol, RARP protocolTCP/IP Detailed learning notes (4)-icmp protocol, Ping and TracerouteTCP/IP Detailed learning notes (5)-ip route selection, dynamic routing, and some detailsTCP/IP Detailed learning notes (6)-UDP protocolTCP/IP Detailed learning notes (7)-Broadcast and multicast, IGMP protocolTCP/IP Detailed learning notes (8)-DNS Domain Name SystemTCP/IP Detailed learning notes (9)-TCP Protocol OverviewTCP/IP Detailed learning Note (-TCP) establishment and termination of the connectionTCP/IP Detailed learning notes (one)-tcp Interactive data flow, block data flowTCP/IP Detailed learning Note (-TCP) timeout and retransmissionTCP/IP Detailed learning notes (-TCP) persistence timer, TCP keepalive timer
Network model of 2.Java network programming