difference
in the network communication, TCP is similar to making a phone call, in this way for network communication, you need to establish a dedicated virtual connection, and then perform reliable data transmission, if the data sent failed, the client will automatically resend the data. and the UDP Way is similar to sends the text message, uses this way carries on the network communication, does not need to establish the specialized virtual connection, the transmission is not very reliable, if sends the failure the client cannot obtain.
These two modes of transmission are real In network programming, important data is generally used in the tcp means data transfer, while a large number of non-core data are udp way to pass, in some programs even use these two ways to carry out the data.
because tcp Tcp
summary   tcp  udp |
TCP protocol
TCP (Transfer Control Protocol) is a connection-oriented, so-called connection-oriented, that is, when the two sides of the computer communication must first establish a connection, then data transmission, and finally remove the connection three processes.
tcp when you make a connection, it's three steps away:
Syn synchronize message, syn sync message indicates the port used by the client and tcp
, the server receives the client's syn tcp< Span style= "margin:0px;padding:0px;font-family: ' The song Body '; > The number is added one, ack acknowledgement
ack The serial number is added one to this tcp
That's what it says. Three-time handshake (three-way handshake) for TCP. According to the characteristics of the three-time handshake, there is an attack on the server called a Syn Flood flood attack.
UDP protocol
socket Communication is a point-to-point communication that is based on the tcp
on the network transmission mode , there is another form of communication based on the udp protocol, called datagram communication. In this way, each data sending unit is uniformly encapsulated into a packet, the sender sends the packet to the network, and the packet is in the network to find his destination.
"Full stack Java notes" is a can help you from Zeto long for the full stack of Java Engineer Series of notes. The author is called Mr. G,10 years Java research and development experience, has been in the digital, Aerospace Institute of a Research and development center engaged in software design and research and development work, from small white gradually achieve engineers, senior engineers, architects. Proficient in Java Platform Software development, Master Java EE, familiar with various popular development framework.
The notes contain six parts from shallow into deep:
A-java Introductory Phase
B-Database from beginner to proficient
C-hand Edge mobile front end and web front end
D-j2ee from understanding to combat
E-java Advanced Frame Fine Solution
F-linux and Hadoop
This article is from the "12931675" blog, please be sure to keep this source http://12941675.blog.51cto.com/12931675/1945776
12.2-Full Stack Java notes: TCP protocol and UDP protocol