TCP requires three handshake to build, and four waves to disconnect. The entire process is as follows:Let's take a look at how to make a connection.First, the client sends the connection request message, the Server section accepts the connection and replies to the ACK message, and allocates resources for this connection. An ACK message is also sent to the server segment after the client receives an ACK message, and the resource is allocated so that th
Introduction to TCP three-time handshake
The TCP handshake requires two identifiers in the identity bit: SYN and ACK, and the SEQ sequence number and ACK acknowledgement number in the message;The ACK confirmation number above and the ACK identification bit are different two kinds of data, the lower case ACK represents the ACK confirmation number, the upper case ACK represents the ACK identification bit;
Th
Important sign-bit meanings:ACK: Indicates confirmation. The acknowledgment field for a TCP message is valid only if the ACK flag bit is 1 o'clock.SYN: Represents synchronization and is used to synchronize serial numbers when the connection is established. When Syn=1 and ack=0, it indicates that this is a connection request message. If the other party agrees to establish the connection, the syn=1,ack=1 should be made in the response message. Therefore, the synchronous bit SYN is set to 1, which
, if the consent connection, the response message should make syn=1,ack=1;
Terminates fin, used to release the connection. When Fin=1, the data indicating that the sender of this message has been sent and is required to be released;
window, accounting for 2 bytes, refers to the notification receiver, send the paper you need to have how much space to accept;
Inspection and, accounting for 2 bytes, calibration header and data of the two parts;
The emergency pointer, which accounts for 2 by
the number of bytes of emergency data in the section of this newspaper;
Options, which are variable in length, define some other optional parameters.
establishment of a TCP connection (three-time handshake)
At the very beginning, both the client and the server are in the closed state. The active open connection is for the client, and the passive open connection is the server.
The TCP server process first creates the
sides of the communication use the public key of a party or both to pass and contract the session key (this process is called handshake)3, both parties use the session key to encrypt the communication content of both partiesIt says the principle. You may find it more complicated than it is in practical use. Fortunately, the good pioneers implemented the layer in the operating system or related software, and a nasty name called SSL, the Secure Socket
TCP (Transmission Control Protocol) Transmission Control Protocol
TCP is the transmission control protocol used by the host to control the host layer. It provides reliable connection services and uses three handshakes to establish a connection:
The location code is the TCP flag. There are 6 types of tags: SYN (synchronous established online) ack (acknowledgement confirmation) Psh (push transfer) Fin (finish ended) RST (reset) URG (Urgent urgent)
Sequence Number acknowledge number (confirma
First, let's look at the three-time handshake process for TCP1) First handshake: When establishing a connection, the client sends a SYN packet (SYN=J) to the server and enters the syn_sent state, waiting for the server to confirm; SYN: Synchronous sequence Number (Synchronize Sequence Numbers).2) Second handshake: The server receives the SYN packet, must confirm
When the two hosts use the TCP protocol for communication, a connection is established before data is exchanged. After the communication is complete, the session is closed and the connection is terminated. The connection and session mechanisms ensure the reliability of TCP.
See the steps for establishing and terminating a TCP connection in the figure.
The host tracks each data segment during the session and uses the information in the TCP header to understand the data received by each
I. Analysis of the Three-way handshake protocol
First, let's look at one of the most common things in our life:
During our online shopping, we often chat with customer service like this: We asked Customer Service about something, Customer Service answered, and then we broke the network... After a while, we will log on again and receive a response from the customer service.
This interaction process completes a response three times. This process
If there is a client and a server, and now the client wants to communicate with the server, the client will first send a data packet whose synchronization bit is equal to 1 and the valid bit of the serial number is equal to 0 to the server, (Syn (synchronous bit) equal to 1 indicates the request to establish a link) at the same time, a random sequence number (serial number) will be generated. If it is 100, when the server receives the data sent from the client, from Syn (synchronous bit) = 1, we
Brief introduction:TCP是一种可靠的,面向连接到全双工传输层协议。TCP establishes the three-time handshake process for a connection:
Client A sends a data segment identified as SYN (SYN position 1), which indicates that a connection to the server is to be established, and that the sequence number (seq) of this data segment is a.
Server B sends a data segment that is identified as Syn+ack (syn bit and ack bit both 1), the sequence number (seq) of this data segment i
process given above is called a three-time handshake (three-way handshake).Why does a have to send a confirmation? This is primarily to prevent a failed connection request message from suddenly being sent to B, resulting in an error. Now look at the TCP four waves (release the connection)Now both A and B are in the established state. A's application process first sends a connection release segment to its T
Note: Today, I browsed the open-source blog and found this interesting picture about the tcp handshake. I also wrote the three-way handshake of tcp. Source: http://www.fresh3g.org/blog/post/405/ 650) this. width = 650; "alt =" "src =" http://www.bkjia.com/uploads/allimg/131227/030023HP-0.jpg "border =" 0 "/> tcp three-way handshake process: 1) male ---> [SYN] ---
It is a TCP three-way handshake packet captured by the packet capture tool. This is the three-way handshake of TCP. There are five three-way handshakes on the top, which are separated by four red lines.
Let's take the first three-way handshake as an example:
1. First, send a [SYN] to port 4885 of 192.168.10.56 from Port 9877 of 192.16810.175;
2.192.168.10.56 a
re-sent. The time required in the TIME_WAIT state is dependent on the implementation method. Typical values are 30 seconds, 1 minutes, and 2 minutes. The connection is formally closed after waiting, and all resources (including the port number) are released."Question 1" Why is the handshake three times when it is connected and four times when it is closed?A: The syn+ack message can be sent directly after the server receives the SYN connection request
algorithm and many public key cryptography algorithms.3.3 DH key exchange processUser A and User B share the prime number Q and its generated meta A, now A and B key exchangeUser A: Generates random number Xa User B: Generates a random number Xb A Get Yb after: Calculate ka = (Yb) ^xa mod qb After getting Ya, calculate KB = (Ya) ^XB mod qThe final result is: Ka = KbThe proof process is omitted here, and the surrogate method can soon prove ka = KbAnd the k here is the key that both A and B negot
be re-sent. The time required in the TIME_WAIT state is dependent on the implementation method. Typical values are 30 seconds, 1 minutes, and 2 minutes. The connection is formally closed after waiting, and all resources (including the port number) are released."Question 1" Why is the handshake three times when it is connected and four times when it is closed?A: The syn+ack message can be sent directly after the server receives the SYN connection requ
1, which indicates a TCP connection is establishedFIN: 1 digits, indicating disconnection of the TCP connectionThree-time handshake process description1. Sent by the client to establish a TCP connection request message, wherein the message contains the SEQ sequence number, is generated randomly by the sending side,And the SYN field in the message is set to 1, indicating that a TCP connection is required (Syn=1, seq=x, X is randomly generated)2. The T
up certain files in this directory to enable special features related to the network application, and we can also protect our network security by setting some files in this directory. This article focuses on some of the factors that affect TCP to establish a three-time handshake:1/proc/sys/net/ipv4/tcp_max_syn_backlog (1024)This variable controls the length of the SYN queue received by each listener port, the incoming SYN segment connection request n
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.