TCP packet parsing TCP packet parsing

TCP packet parsing

Outline

In the "network infrastructure summarize (a)" summed up the TCP connection is established processes and disconnected, but the TCP protocol than I know much more complicated, as I know it can be said tip of the iceberg, as summarized only on paper just only have a superficial understanding of TCP, TCP protocol on the recommendation of the details can be read " TCP / IP detailed volume 1: the agreement ", this essay will look at TCP packet it.

TCP packets

How do we distinguish between different application processes on a computer? Just as we distinguish between people, different people give different names to identify, occasionally encounter the same name, the same name on the computer ban phenomenon occurs, different application processes, to distinguish them is different port number , which were occupied this port operation, it does not allow others to use this port, so whether it is TCP or UDP protocol protocol port numbers are particularly important, source and destination ports are essential, without them I do not know the computer to send data to which application process.

Source Port : Source port number on the sending computer.

Destination Port : The port number of the receiving computer.

ID: number, by definition, is the serial number to each transmitted byte compiled a number. Oldest, second oldest, youngest, such TCP to know, which should come first, which should after that, to solve the problem out of order, in the first article written essay, with a packet capture tool to show you three times shake hands, if we can see the sequence number Note there is always zero, in fact not the case, increase seq is the number of bytes transferred and the associated packet capture tool to show a more friendly, using relative numbers.

Confirmation Number: This is better understood, I'll give you a letter (contract), there must be a reply sent to it, did not confirm receipt of the letter, if not back, I think the letter may for some reason, lost (package). I'll continue to send until you receive so far. This solves the problem of packet loss, so we believe are reliable TCP protocol, but TCP, his face is very complex network environment, if the network is indeed very poor condition, there is no valid guarantee, TCP also powerless, can do, is try to retransmission.

Data Offset: data offset there is a name, also known as the header length, because the TCP header is of variable length, this segment in the end how long, that indicate what position the entire TCP data portion of the TCP segment.

Then there is the number of status bits in the first essays have mentioned, SYN launch online, ACK reply, RST back online, FIN end of the line and other, previously mentioned TCP protocol is duplex, the two sides should maintain the status of the connection send these packages with status bits, it can cause changes in both the states. Like reality, between people, the two sides continue to send out different signals, both sides of the relationship will continue to change, personally think that is a reason.

Window: right professional point of informing the sender that the receiving side caching how much control the rate of the sender to send data to achieve flow control. In fact, both sides declared a communication window, identify their ability to handle, do not send too fast Ah, the receiving end explode, do not send too slow, wasting processing power.

And test: This is a bit like our common code, is not the entire TCP segment, any changes to the TCP header and data occurs mainly between the sender and the receiver, the receiver check in error, the TCP segment will be discarded.

Urgent pointer: the urgent pointer, we must think of our flag UGR, it is to be used in conjunction with URG, this means that only urgent pointer URG is set to be useful. Urgent, urgent, urgent eight hundred years, its role is clear, TCP know you want to send the urgent data, will be the next TCP data transmission, all TCP segments URG flag is set, even if you segment no emergency data, this action should continue until the emergency data is transmitted. Note that the data is not urgent to open up a new connection path is sent individually, still sent along with the normal data.

Options section: the maximum packet size, the length of the sender or the receiver can accept the maximum segment. This is typically connected party option specified in the first communication segment.

Padding: see to know the name of justice, Options section if it is not an integer multiple of 32, to add padding bits, adding an extra zero to ensure that the TCP header is an integer multiple of 32.

Data section :  the data portion of the TCP segment is optional. When a connection is established and a connection is terminated, the two sides exchanged only a segment of  the TCP header. If a party has no data to send, also did not use the header data to confirm the reception of any data. In many cases, the timeout process also transmitted without any data segment.

Reference: https: //www.cnblogs.com/feng9exe/p/8058891.html

Guess you like

Origin www.cnblogs.com/Leo_wl/p/10959051.html