SYN, FIN, ACK, PSH, RST, and URG in TCP Packets

Source: Internet
Author: User
Tags connection reset


How to perform the three-way handshake of SYN, FIN, ACK, PSH, RST, and urg tcp in TCP Packets: the sender sends a packet with SYN = 1, ACK = 0 to the receiver, this is the first handshake between requests. If the receiving end receives the request and allows the connection, it will send a packet with SYN = 1, ACK = 1 to the sending end and tell it, the sender can send a confirmation packet, which is the second handshake. Finally, the sender sends a SYN = 0, ACK = 1 packet to the receiver, tell it that the connection has been confirmed. This is the third handshake. Then, a TCP connection is established to Start Communication. Www.2cto.com * SYN: The Synchronize Sequence number column is valid. This flag is valid only when three handshakes are used to establish a TCP connection. It indicates the serial number of the server check sequence of the TCP connection. The serial number is the serial number of the initial client of the TCP connection. Here, we can regard the TCP sequence number as a 32-bit counter ranging from 0 to 4,294,967,295. Each byte in the data exchange over TCP connections is serial number. The serial number column in the TCP header contains the serial number of the first byte in the TCP segment. * ACK: The Acknowledgement Number column is valid. In most cases, this flag is set. The validation number (w + 1, Figure-1) contained in the validation number column in the TCP header is the next expected sequence number, prompting that the remote system has successfully received all data. * RST: the reset flag is valid. Used to reset the corresponding TCP connection. Www.2cto.com * URG: The urgent pointer mark is valid. Emergency flag location, * PSH: when the flag is set, the receiving end does not process the data in the queue, but forwards the data to the application as soon as possible. This flag is always set to a bit when you connect to telnet, rlogin, or other interactive modes. * FIN: a packet with a flag position is used to end a TCP session, but the corresponding port is still open and is ready to receive subsequent data. Several TCP statuses play a role in our analysis on the TCP layer. There is a FLAGS field, which has the following identifiers: SYN, FIN, ACK, PSH, RST, and URG. the preceding five fields are useful for our daily analysis. They mean: SYN indicates a connection, FIN indicates a closed connection, ACK indicates a response, PSH indicates DATA transmission, and RST indicates a Connection reset. Among them, ACK may be used together with SYN, FIN, etc. For example, SYN and ACK may both be 1, which indicates the response after the connection is established. If it is only a single SYN, it only indicates establishing a connection. The several handshakes of TCP are represented by such ACK. However, SYN and FIN are not 1 at the same time, because the former indicates a connection, while the latter indicates a disconnection. RST is usually 1 after FIN, indicating that the connection is reset. Generally, when a FIN or RST packet occurs, we think that the client is disconnected from the server. When a SYN and SYN + ACK packet appears, we think the client has established a connection with the server. When PSH is 1, it usually only appears in packets whose DATA content is not 0. That is to say, PSH is 1, indicating that the real TCP packet content is transmitted. Both TCP connection establishment and connection closure are completed in request-response mode.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.