TCP three-way handshake and four waving, flow control and congestion control of TCP

70, three TCP handshake agreement with the four waving
70.1, TCP packet structure

  1, source port number: port number of transmission indicates, the field length is 16 bits.
  2, the destination port number: indicates reception port number field is 16 bits long.
  3, SEQ ID NO: indicates the position of transmission data, 32-bit length field. Each transmission time data, the cumulative size of the primary number of data bytes.
  Note: sequence number 0 or 1 does not start, but the establishment of a random number generated by the computer as connected to its initial value, is sent to the receiving host via SYN packet. Then the number of bytes per forwarded past accumulated into the position data representing the initial value.
  4, the acknowledgment number: indicates the serial number of the next data to be received, the field length is 32 bytes. After the sender receives the acknowledgment data can be considered in the previous sequence number have been received normally.
  Number of advantages:
  (1) ensure that packets arrive out of order.
  (2) reliability.
  (3) ensure efficiency.
  (4) accurate report which has received the message, which needs to be retransmitted.
  5, the header length: This field is 4 bits, in units of 4 bytes (32 bits). TCP header length does not include the option, then, is 20 bytes, binary sequence 20/4 = 5, 5: 0101, header length, also known as offset data, so this field may be set to 5, the option field is maximum 40 characters section, so that a maximum TCP header length is 20 + 40 = 60 bytes, the maximum length of this field may be set to 60/4 = 15.
  6, Reserved: This field is mainly used for future expansion, its length is 4 bits. Generally set to 0, the packet received in the even field is not 0, this package is not discarded.
  7, the control bits: 6 field length, each left to right are: URG, ACK, PSH, RST , SYN, FIN. When the corresponding value is 1, there are specific meaning.

Field Meaning
URG urgent pointer is valid. 1, indicating a need to be a priority.
ACK acknowledgment number is valid, is generally set to 1.
PSH prompts the receiver application immediately go read data from the TCP buffer.
RST other requirements to re-establish a connection reset.
SYN requests to establish a connection, and the initial value setting its sequence number in a sequence number field. Establish a connection, is set to 1.
FIN want to disconnect.
  8, the window size: size of the receive buffer, TCP allowed to send data exceeds the size shown here.
  9, the checksum: sending end stuffing, CRC checking, by verification is not received, the data is considered a problem. And UDP difference is, UDP checksum of the data itself, not only the TCP checksum includes TCP header, and contains TCP data portion.
  10, urgent pointer: 1 is only valid when the URG, this field is represented by a pointer in the section of the newspaper text urgent data.
  11, option: to improve the performance of TCP. We need to be controlled in accordance with the header length, maximum length of 40 bytes.


70.2, TCP three-way handshake, and a field used in the four wave
  1, SEQ ID NO seq
  4 bytes for the data segment order mark, the TCP connection all data bytes transmitted are compiled on a serial number, a first byte generated by the random number locally compiled on the number of bytes to, give each segment is assigned a serial number, a sequence number seq is the first byte of the data segment number.
  2, ack acknowledgment number
  4 bytes, the other next expects to receive the first data byte of the segment sequence number, the sequence number for the first byte of the data segment number carried in, the confirmation number It refers to a desired number of the next byte is received, so the current number plus the last byte of the segment that is the acknowledgment number.
  3, acknowledgment ACK
  representing one bit, only when ACK = 1, the acknowledgment number field is valid. ACK = 0, the acknowledgment number is invalid.
  4, the synchronization SYN
  for synchronization serial connection is established. When SYN = 1, ACK = 0 indicates: this is a connection request packet segments. If the agreed connection, in the response message segments using SYN = 1, ACK = 1. Accordingly, SYN = 1 indicates that this is a connection request, or the received message is connected, the SYN flag in the TCP connection is established will not only be set to 1, after the completion of the handshake SYN flag bit is set to 0.
  5, FIN termination
  for releasing a connection.


70.3, TCP three-way handshake

  step1: first handshake
  connection is established, the client sends a SYN packet to the server, which contains the client's initial sequence number seq = x, and enters the SYN_SENT state, waiting for the server to confirm. (Wherein, SYN = 1, ACK = 0 , indicates that this data is a TCP connection request packet; sequence number seq = x, indicates that the first data byte sequence number when the transmission data is x).
  step2: second handshake
  server receives a request, must confirm the customer's data package. While themselves sends a SYN packet, i.e., SYN + ACK packet, then the server enters a state SYN_RECV. (Wherein acknowledgment segments, flag SYN = 1, ACK = 1, indicates that this is a TCP connection response data packet, and contains an initial sequence number SEQ (server) = y server, and the server to the client initial sequence number ACK acknowledgment number (server) = seq (client) + 1 = x + 1) .
  step3: third handshake
  client receives the SYN + ACK packet to the server, the server sends a sequence number (seq = x + 1), for the ACK acknowledgment number (client) = y + 1, this packet transmission is completed, the client end server and enter ESTAB_LISHED (TCP connection succeeds) state, complete the three-way handshake.
  No connection queue
  in three-way handshake protocol, the server is not connected to maintain a queue, the team as each client's SYN packet (syn = j) creation of an entry, the entry indicates that the server SYN packet has been received, a confirmation to the customer, when the customer is waiting for confirmation package, delete the entry, the server into ESTAB_LISHED state.


70.4, (client to server connection is closed) during four wave
  step1: the first wave
  First, a client sends the FIN, for closing the client's data transmission server, the server then waits for an acknowledgment. Wherein the termination flag FIN = 1, the sequence number seq = u.
  step2: the second wave
  server receives the FIN, it sends an ACK, acknowledgment ack is received sequence number plus one.
  step3: third wave
  off the server connected to the client, the client sends a FIN.
  step4: Fourth Wave
  client after client receives FIN, ACK packet and sends back a confirmation and acknowledgment number seq is set to receive the serial number plus one. First off will be the one to perform active close, while the other performs a passive close.
  After the client sends FIN, enter the wait state is terminated, the server receives the client connection release segment, it is immediately sent to the client to confirm, enter the server CLOSE_WAIT state, then TCP server process will inform high-level application process, and thus from client to server connection is released. In this case the "semi-closed", i.e., the client may not be sent to the server, the server may send to the client.
  At this point, if the server does not send data packets to the client, its application will notify the release of TCP connection, and then sent to the client connection release datagram, and wait for confirmation. After the client sends an acknowledgment, enter TIME_WAIT state, but this time the TCP connection is not released, then after 2MSL wait timer settings (2 times the maximum age of the message), before entering into the CLOSE state.
  [Note] connection can be interrupted Client side, it can be the Server side.
  Client-initiated assume interrupt connection request is sent FIN message. Server-side after receiving FIN messages, meaning "I do not Client-side data to be sent to you," but if you have no data transmission is complete, you do not hurry to close the Socket, you can continue to send data. So before you send ACK, "he tells the Client side, your request I received, but I'm not ready, please continue your message waiting for me." Client-side this time entered FIN_WAIT state, continue to wait FIN packets Server side. Server data to determine when the end has been sent, then send a FIN packet to the Client-side "Tell Client-side, well, I ran out data here, ready to close the connection." Client after client receives FIN message, "you know that you can close the connection, but he still did not trust the Internet, afraid Server side does not know to turn off, so after sending ACK enter TIME_WAIT state, if the Server does not receive ACK can be heavy Biography. "after Server client receives ACK," you know that you can become disconnected. " Client-waiting after 2MSL still not received a reply, then prove Server has a normally closed end, well, I Client-side can also close the connection. Ok, TCP connection is so closed!


70.5 Why do you need three-way handshake, the two can not it? Or four, five, okay?
  We analyze a special case, assuming that the client requests to establish a connection, a SYN packet to the server waits for the server to confirm, the server receives confirmation, if it is two-way handshake, assuming that the server sends the data in the second handshake to the client, data sent from the server, the server considers the connection has been established, but data is lost in the process of sending data, the client considers the connection is not established, it will be retransmitted. Assuming that each transmitted data has been lost, the client has SYN, the server will generate more invalid connection, footprint, the server may hang at this time. This phenomenon is what we heard "SYN flood attack."
  Summary: The third handshake is to prevent: If the client has yet to receive server returns a confirmation message, then give up, restart a connection request, but the problem is: the server does not know the client does not receive, so he will receive two connections, waste connection overhead. If you always do, you will waste more connection overhead.
  But also to prevent failure of the connection request packet to the server segment suddenly, resulting in an error.


70.6 Why is waving four, instead of three or five, six?
  Ensure that the data transfer can be completed.
  When the connection is closed, upon receipt of each other's FIN message notification, it merely indicates that the person no data is sent to you; but not necessarily all of you have all the data is sent to the other party, so you can not necessarily immediately closed SOCKET, also that is, you may also need to send some data to each other after, then send FIN messages to each other to indicate that you agree can now close the connection, so under most circumstances it here ACK packets and FIN packets are sent separately.
  TCP protocol is a connection-oriented, reliable transport layer protocol based on the byte stream. TCP is full-duplex mode, which means that, when the host 1 issues a FIN segment, but said the host 1 has no data to send, and tells the host 2 host 1, its data have all been sent up; however, this time, the host 1 or can accept data from the host computer 2; and when the master device 2 returns an ACK segment, indicating that it already knows the host 1 does not have data transmitted, but the host 2 can still send data to the host 1; when the host 2 also when sending a FIN segment, this time that the host 2 also has no data to send, it will tell the host 1, I have no data to send, and then will pleasantly interrupt the TCP connection with each other.


70.7 reasons time_wait state produced?
  1) reliably achieve full-duplex TCP connection is terminated
  we must hypothetical network is not reliable, you can not guarantee that you sent last ACK packet will definitely be received at the other, so the other party in the case of LAST_ACK SOCKET status may because the timeout ACK is not received packets, and retransmits packets FIN, client must maintain this state of the connection (to keep time_wait, specifically, it is that the TCP connection corresponding (local_ip, local_port) resources can not be released immediately, or reallocation) so that it can retransmit the lost of the ACK, if the active closed end of the TIME_WAIT state is not maintained, but in the cLOSED state, a active close the RST terminal will respond, the result as error server, the server does not lead to a graceful close. ** So the role of the TIME_WAIT state is used to retransmit ACK packets may be lost. After ** So, when the client waits 2MSL (2 times the maximum age of the message), you do not receive FIN message server, and the server will know that he has received the ACK packet, the client this time to shut itself down Connection.
  2), to allow passage of the old section is repeated in the network
  2MSL this connection can be made within the time duration of all segments generated disappeared from the network. So we can make the next new connection request segments of the old connection does not appear.
  If the TIME_WAIT state holding time is not long enough (say less than 2MSL), a first connection is properly terminated. The second one with the same four-tuple (local_ip, local_port, remote_ip, remote_port) appears connection (TCP connection set up between the same IP address and port), and repeating the first connection message arrives, the interference The second connection. TCP implementation must occur to prevent a duplicate packets after connection termination connections, so that it remains long enough TIME_WAIT state (2MSL), connected to the corresponding direction in response to TCP packets either fully completed or discarded. When establishing a second connection, without confusion.


70.8 If a large number of network connections in the TIME_WAIT state appears the harm?
  If there are a lot of socket in the TIME_WAIT state, when you need to create a new socket when the connection may be affected, which will also affect the scalability of the system.
  The reason TIME_WAIT can affect scalability of the system because in a TCP connection, a Socket if turned off, it remains in the TIME_WAIT state is about 1-4 minutes. If many socket connection fast opening and closing, then the system is in the TIME_WAIT state will accumulate a lot, due to the limited number of local port, at the same time only a limited number of socket connections can be established, if too many socket in the TIME_WAIT state, you You will find that, due to the lack of local ports for too new connection will be very difficult to establish a new external connection.


70.9, TCP how to ensure the reliability of the transmission?
  0, before passing the data, there will be three-way handshake to establish a connection.
  1, application data is divided into data block deemed most appropriate TCP transmission (byte number, reasonable slice). This is completely different UDP datagram length generated by the application will remain unchanged. (Data will be truncated to a reasonable length)
  2, when a TCP segment sent, it starts a timer, waits for the destination to acknowledge receipt of the segment. If you can not receive a confirmation, it will retransmit this segment. (Retransmission timeout)
  3, when the TCP connection is received from the bottom of the other end of the TCP data, it sends an acknowledgment. This acknowledgment is not sent immediately, usually postpone fraction of a second. (For requests received, given acknowledgment) (the reason to postpone, may be to do a complete check on the package).
  4, TCP test and it will keep the header and data. This test is an end and the aim of detecting any change in the data transmission process. If you receive a section of the test and an error, TCP discards this segment and do not acknowledge receipt of this segment. (Verifies that the packet is wrong, the packet discard section, no response is given, TCP data transmitting terminal, will timeout retransmission data)
  5, since TCP segment is transmitted as an IP datagram, the IP datagram arrives it may be out of order, so the arrival of TCP segments may also be out of order. If necessary, the data received by the TCP will reorder the data will be received in the correct order to the application layer. (Data for reordering out of sequence, and then will be delivered to the application layer)
  6, since the IP datagram occur repeatedly, the receiver must discard duplicate TCP data. (For duplicate data, it is possible to discard duplicate data)
  7, TCP also provides flow control. Each TCP connection has a fixed side buffer space size. Receiving TCP only allows the other end of the transmitting and receiving end can receive the data buffer. This will prevent the buffer faster host resulting in slower host overflow. (TCP flow control may be performed, resulting in preventing the rapid host buffer overflow slower host) flow control protocol TCP is used in a variable size sliding window protocol.
  8, TCP also provides congestion control. When network congestion, reducing transmission data.


70.10, after the TCP connection is established how to stay connected (not detecting the connection is broken off)?
  There are two techniques you can use. One is Keepalive mechanism implemented by the TCP protocol layer, the other is by the application layer packet HeartBeat heartbeat own implementation.
  1, there is in a TCP Keep-alive mechanism can detect dead connections very simple principle, when connecting certain amount of time (the parameter value may be set, the default is two hours), TCP protocol will send a keepalive probes to each other package (no data in the packet), the other after receiving the package, if the connection is working, it should respond with a ACK; if the connection goes wrong (such as your partner restart, the connection status is lost), you should respond with a RST; if the other party does not reply, then the server at regular intervals (the parameter value may be set) keepalive probe packet retransmission, if a plurality of successive packet (the parameter value may be set) are ignored, the connection is disconnected.
  2, was called heartbeat heartbeat packet package because: it is the same hair once every fixed time, in order to tell the server that the client is still alive, like a heartbeat. In fact this is in order to maintain a long connection, as to the contents of this package, is nothing special provisions, but these are generally very small package, or contains only an empty packet header. Heartbeat packets are sent by the application itself to detect the health of the connection. The client may or low-level thread regularly sent to the server in a Timer in a dapper pack, and wait for a response server. The client program within a certain time has not received a response that is considered the server connection is not available, the same server is not received within a certain time client heartbeat packets believes the client has been dropped.  

 


71, TCP flow control (sliding window mechanism)
  The basic principle is the sliding window protocol at any time, transmits a continuous holding Fangdu Wei allow frame transmission sequence number, called the send window; the same time, the receiver also maintains a continuous allows the received frame sequence number, called the receive window. Number of transmission and receive windows bounds not necessarily the same, or may be different sizes. Different sliding window protocol generally different window size.
  The so-called sliding window protocol, their understanding is twofold: 1), the "window" is a sequence of bytes corresponding to a period of the sender can be transmitted, which is called a continuous range "window"; 2) "slide" is this means "an allowable range of transmitted" is transmitted as the process changes, the way is in order "sliding." Prior to first understand the following conditions:
  1, respectively, at both ends of TCP sender A and recipient B, since a full-duplex protocol, so A and B should be maintained with a separate transmit buffer and receive buffer, respectively region, since the other of (a fat B receive and B send a received), we send the case B receives as an example to a;
  that portion can be transmitted TCP protocol 2, the transmission window is a portion of the transmission buffer, is, in fact, all the application layer data needs to be sent have been put into the send buffer of the sender;
  3, sent the relevant window there are four concepts: sent and received confirmation of the data (not in a send window and the send buffer ), was sent but not received confirmation of the data (located within the transmit window) that allows data transmission but have not sent outside the send window and send data in the buffer temporarily not allowed to be transmitted;
  4, after each successful send data, window will move sequentially transmitted in the transmission buffer, containing the new data is ready to send to the window;


71.1, flow control
  aspects of the flow control has two main points need to master. First, the use of TCP sliding window mechanism to achieve flow control; the second is to consider how the transmission efficiency of traffic control.
  1, flow control
  so-called flow control, mainly the receiver to the sender to transmit information, so as not to send data fast, is an end to end control. The main way to back an ACK will contain its own receive window size, to control the size and use of data transmission the sender:

  This relates to a situation which, if B had told his A buffer is full, then A stop sending data; after waiting for some time, the emergence of a surplus buffer B, then A sends a message to tell me A rwnd size is 400, but unfortunately the message is lost, so it was waiting for notification B of a || B a deadlock condition waiting to send data. To deal with this problem, TCP introduced the continuous timer (Persistence timer), when A receives the other side of zero window notification, the timer is enabled, it is time to send a 1-byte probe packets, the other party will At this time, its response to the reception window size, if the result is still 0, the timer is continuously reset, continues to wait.
  2, the transmission efficiency of
  the obvious question is: single byte single acknowledgment is sent, and the window has a spare notify the sender to send a byte, will increase the number of unnecessary packet network (Think for a word section 40 bytes of data added the head of it!), so our principle is to send more than a few bytes as possible, notify the sender window or spare more time to send multiple bytes. For the former we make extensive use Nagle algorithm, namely:
  1), data is sent if the application process should be sent to the TCP byte by byte transmit buffer, the sender put the first data byte to send out the back cached byte first;
  2), when the sender receives acknowledgment of the first byte (and also the other case where the network receive window size), then the remaining bytes of the packet buffer of suitable size sending out;
  3), when the data arrives has reached half a transmission window size or the maximum length of the segment of the time, it immediately sends a message segment;
  for the latter approach is that we tend to wait for a while to let the recipient time, or recipient sufficient space to accommodate a segment or until receive cache half free time, and then notifies the sender transmits data.


71.2, congestion control
  in the network switch node and link capacity in the cache and processor have operating limits, when the demand of the network exceed their operating limits, congestion appeared. Congestion control is to prevent excessive injection of data into the network, this could make the network routers or links is not overloaded. Common method is:
  1, the slow start, congestion control;
  2, fast retransmit, and fast recovery;
  the foundation of all or slow start, the idea of this method is as follows:
  1) the sender maintain a called "congestion window" variable, the variable and receive ports together determine the transmission window of the sender;
  2), when the host begins to transmit data, to avoid a sudden large amount of bytes injected into the network, resulting in increased congestion or select a transmission of 1 byte probe packet;
  3) Upon receipt of the first acknowledgment data byte, sends two bytes of the packet;
  4), if confirmation is received once again 2 bytes, is transmitted four words Day, in ascending order exponential 2;
  5), and finally reaches a pre-set in advance "slow start threshold", such as 24, that once sent 24 groups, then follow the following condition is determined:
  * 1, cwnd < ssthresh, continue to use the slow start algorithm;
  * 2, CWnd> ssthresh, stop using the slow start algorithm, congestion avoidance algorithms use;
  *. 3, CWnd = ssthresh, may be used slow start algorithm, congestion avoidance algorithms may be used
  6), the so-called congestion avoidance algorithm is this: after every round-trip time RTT put a +1 congestion window of the sender, namely the congestion window so that slowly increases, an increase in a linear law;
  7), when there is network congestion, such as packet loss when the slow start threshold to half of the original, and then cwnd is set to 1, the slow start algorithm execution (lower starting point, exponential growth);


  Object of the above method is reduced when congestion occurs in a sequential number of packets sent to the host in the network, so that the router of congestion have enough time to queue backlog of packet processed. Slow start and congestion control algorithm is often used as a whole, and fast retransmission and fast recovery are to reduce the time as a retransmission packet loss due to congestion caused, thereby avoiding unnecessary transmission of data to the network. Fast retransmission mechanism is:
  1), entering into the receiving such a mechanism, if a packet is lost, it continues to send the retransmission request packet for subsequent packet;
  2), once the sender receives confirmation of the same three , you know that an error has occurred after the package immediately retransmit the packet;
  3), then the sender begin "fast recovery" algorithm:
  * 1, the slow start threshold is halved;
  * 2, cwnd set to a slow start threshold reduction value after half;
  * 3, performs congestion avoidance algorithm (starting point, linear growth);


  TCP sliding window protocol, the window is too large or too small to have any effect?
  The size of the sliding window has a great impact on network performance.
  If the sliding window is too small, in extreme cases stop and wait protocol, send a message waiting for an ACK, result in communication efficiency.
  If the sliding window is too large, easy to network congestion, the receiving side is likely to cause buffer overflow insufficient, prone to packet loss, the data needs to be sent repeatedly, consumes network bandwidth.  

 


72, TCP and UDP contrast to
  TCP, UDP is a transport layer protocol, with the communication mechanism of their different application scenario.
  TCP (Transmission Control Protocol), also known as the Transmission Control Protocol, UDP (User Datagram Protocol), also known as the User Datagram Protocol, which are transport layer protocol, but the two different mechanisms, their differences are as follows:

Characteristics of the UDP TCP
connectivity for non-connection-oriented connection
reliability reliable unreliable
transmission efficiency slow speed
  advantages of TCP: reliable and stable. TCP Reliable reflected in the TCP before passing the data, there will be three-way handshake to establish a connection, but at the time of data transfer, confirmation, windows, retransmission, congestion control mechanisms, in data transfer finished, will be used to disconnect conserve system resources. TCP's shortcomings: slow, low efficiency, high system resources, vulnerable to attack. TCP before passing the data must first build connections, which will consume time, but also in the data transfer, acknowledgment mechanism, retransmission mechanism, and congestion control mechanisms will consume a lot of time, but also to maintain all transmissions on each device connection, in fact, each CPU, memory and other hardware resources connected to the system will occupy. Moreover, there is an acknowledgment mechanism because TCP three-way handshake mechanism, which also led to TCP vulnerable to exploitation, to achieve DOS, DDOS, CC attacks.
  UDP advantage: the fast, slightly safer than TCP. UDP does not TCP handshake confirmation window, retransmission, congestion control mechanisms, stateless UDP is a transport protocol, so it is very fast when transferring data. Without these mechanisms of TCP, UDP than TCP vulnerabilities being exploited by attackers would be less. UDP attacks but also can not be avoided, such as: UDP Flood attack ......; the disadvantage of UDP: unreliable, unstable, because there is no UDP TCP those reliable mechanism, at the time of data transfer, if the network quality is not good, it would be easy packet loss.
  Based on the above advantages and disadvantages, then: When should you use TCP: When there are requirements for network communication quality, such as: the accuracy of the entire data to be passed to the other side, which is often some of the requirements for reliable applications, such as HTTP, HTTPS , file transfer protocol such as FTP, POP, SMTP and other mail transfer protocol. In daily life, common applications use the TCP protocol are as follows: browser, use HTTP FlashFXP, using FTP Outlook, using POP, SMTP Putty, use Telnet, SSH QQ file transfer ............; When to use UDP: when the network communication quality less demanding, requiring network communication speed can be fast as possible, then you can use UDP. For example, in daily life, it is common to use UDP protocol applications are as follows: QQ voice, QQ video, TFTP .......
  TCP and UDP are summarized differences:
  . 1, TCP connection-oriented (e.g., dial-up connection is established first call); UDP is connectionless, i.e. without establishing a connection before sending data;
  2, TCP provides reliable service. In other words, the data transfer TCP connection, error-free, not lost, not repeat, and arrive out of order; UDP best effort, that does not guarantee reliable delivery;
  3, TCP byte stream-oriented, in fact, the TCP as a series of data byte stream unstructured; is for the UDP packets, UDP no congestion control, and therefore does not cause a congestion transmission source host of the network is reduced rate (real-time applications are useful, such as IP telephony, real-time video conferences etc.);
  4, each TCP connection is only a point to point; UDP support one, one to many, and many-to-many interactive communications;
  . 5, 20-byte TCP header overhead; the UDP header small overhead, only 8 bytes;
  6, logical communication channel is TCP reliable full-duplex channel, UDP is an unreliable channel;


72.1, reliability supplement
  in the communication point of view, that is, to ensure reliable communication of information and communication between the two sides is not lost, is lost if a guarantee can be restored, and the information content of the original receipt to send the same content.
  In TCP, the transmission packets are to be transmitted via a virtual connection is established, the sender transmission of each TCP packet will be numbered (numbers are due to network transmission, the message may be sent out of order arrival, hence the need for numbering packets according rearrangement), and a timer is turned on; when the receiving end receives the packets, and by checking the checksum of the received data packet, if the check is successful, returns a confirmation message to inform the sender I have successfully received the message; if the sender before the end of the timer not receive the confirmation message, then that failure to receive the receiving end, the packet will be retransmitted ; if the server received duplicate packets (according to the numbering is found to have been received), the message will be discarded.
  UDP does not need to make sure that the server must be able to receive or receiving the complete data. It merely provides a mechanism to check and guarantee a packet is complete, if the verification fails, then the packet is discarded, without any treatment.
  Based application layer protocol TCP protocol: http, ftp, telnet, smtp ;
  application layer protocol UDP protocol: dns, RIP, the
TFTP; ----------------
Disclaimer: This article CSDN bloggers as "knowing and Rangers' original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/zengxiantao1994/article/details/94634110

Guess you like

Origin www.cnblogs.com/lijunji/p/11491638.html