In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
Small Q: This week has been in Beijing to apply for resume interview, long time did not come; catch up with Saturday, come back to rest, review review;
--------------------------------------------------------------------------------------
This article is too good, have time to see, TCP/IP can have an in-depth detailed understanding www.cnblogs.com/fengzanfeng/articles/1339347.html
About TCP/IP protocol establishment and disconnection there are three handshakes and four waves of the statement, the following is a simple and clear...
A brief explanation of the status bits:
SYN (synchronous) is the handshake signal used by TCP/IP to establish a connection.
ACK (Acknowledgement): Acknowledgement that the data has been received correctly.
CLOSED: There is nothing to say about this, indicating the initial closed state.
LISTEN: Indicates that a SOCKET on the server side is listening and can accept connections.
SYN_RCVD: This state indicates that SYN messages have been received.
SYN_SENT: This state echoes SYN_RCVD and indicates that the client has sent a SYN message.
ESTABLISHED: This is easy to understand, indicating that the connection has been established.
FIN_WAIT_1/2: This state needs to be explained. In fact, the real meaning of FIN_WAIT_1 and FIN_WAIT_2 states is to wait for the FIN message of the other party;(FIN_WAIT_1 state actually means that when SOCKET is in ESTABLISHED state, it wants to close the connection actively and sends FIN message to the other party. At this time, SOCKET enters FIN_WAIT_1 state. When the other party responds to the ACK message, it enters the FIN_WAIT_2 state. Of course, under normal circumstances, the other party should immediately respond to the ACK message no matter what the circumstances are.) Therefore, the FIN_WAIT_1 state is generally difficult to see, and the FIN_WAIT_2 state can sometimes be seen with netstat.
CLOSING: The status is quite special, which is rare in actual situations; it means that after you send FIN messages, you do not receive ACK messages from the other party, but you also receive FIN messages from the other party; think about it: if both parties close a SOCKET almost at the same time, then there will be a situation where both parties send FIN messages at the same time, that is, CLOSING status will appear, indicating that both parties are closing the SOCKET connection.
CLOSE_WAIT: This state actually means waiting to close;
LAST_ACK: The passive shutdown party waits for the ACK message of the other party after sending the FIN message. When the ACK message is received, it can enter the CLOSED available state.
TIME_WAIT: Indicates that the FIN message from the other party has been received and an ACK message has been sent. After waiting for 2MSL, the CLOSED available state is returned. If a message with FIN flag and ACK flag is received from the other party in FIN_WAIT_1 state, it can directly enter TIME_WAIT state without going through FIN_WAIT_2 state.
Three handshakes:
First, the Client sends a connection request message, and the server receives the connection and replies with an ACK message, and allocates resources for the connection. After receiving the ACK message, the Client also sends an ACK message to the Server segment and allocates resources, so that the TCP connection is established.
Four waves:
The interrupt connection side can be the Client side or the Server side, that is to say, it can also be considered in reverse.
Assume that the client initiates an interrupt connection request, that is, sends a FIN message. After the Server receives the FIN message, it means "I have no data to send to you at the client end", but if you still have data to send, you don't have to close the Socket in a hurry, you can continue to send data. So you send an ACK first,"Tell the Client that I received your request, but I'm not ready yet, please continue to wait for my message." At this time, the Client enters FIN_WAIT1 state and continues to wait for FIN messages from the Server. When the Server determines that the data has been sent, it sends a FIN message to the client,"Tell the client, OK, I have finished sending data, ready to close the connection." After the Client receives the FIN message, it knows that it can close the connection, but it still does not believe in the network. It is afraid that the Server does not know to close it, so it enters the TIME_WAIT2 state after sending ACK. If the Server does not receive ACK, it can retransmit. After the Server receives the ACK, it knows that it can disconnect. The Client side still does not receive a reply after waiting for 2MSL, which proves that the Server side has been closed normally. Well, my Client side can also close the connection. Ok, TCP connection just closed!
-------------------
Because although both parties agree to close the connection, and the four handshake messages are coordinated and sent, it is reasonable to return to the CLOSED state directly; but because we must assume that the network is unreliable, you cannot guarantee that the ACK message you sent last will be received by the other party, so the SOCKET in the LAST_ACK state may not receive the ACK message after timeout, and resend the FIN message. Therefore, the role of this TIME_WAIT state is to resend the ACK message that may be lost.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.