TCP and UDP and IP message formats

Source: Internet
Author: User

Previously, the data transmitted in the network is not clear, by consulting the relevant data, summed up the TCP and UDP and IP message format:


TCP Message Format:


(Reproduced from http://wenku.baidu.com/view/04b0d780e53a580216fcfeaa.html in the picture above)

SOURCE port: The port number of the sender of the data.

Destination port: The port number of the data receiver.

Ordinal number: The ordinal number of the first byte in this data message (each byte in the data stream corresponds to an ordinal number).

Confirmation Number: The ordinal number of the first byte in the next data message that you want to receive.

Data offset: Indicates how far from the message segment the data section of this newspaper is.

Reservation: As the name suggests, used to keep for later use.

Emergency bit Urg: When the value is 1, there is a need for urgent handling in the secondary message segment.

Confirm bit ACK: The value is 1 o'clock confirmation number is valid, the value is 0 o'clock the confirmation number is invalid.

Reset bit rst: A value of 1 indicates a serious error in the TCP connection and requires a reconnection.

Synchronous bit syn: A value of 1 indicates that this is a connection request or a connection acceptance message.

Stop bit fin: A value of 1 indicates that the datagram to be sent has been sent and a delivery connection needs to be released.

Window field: One end of a TCP connection determines the size of the window that it accepts, depending on the size of the cache space, and limits the window to which it is sent.

Inspection and: Used to test the correctness of the first and the two parts of the data.

Emergency pointer field: The last byte ordinal of the emergency data in this newspaper.


UDP message Format:



The source port number and destination port number are the same as those on TCP.

UDP length: The byte length of the UDP message (including the header and data).

UDP Checksum: Verifies the correctness of the UDP header and data portions.



IP message Format:


Version: Refers to the version of the IP protocol.

Header length: Length of header

Service type: The following figure:

Priority is used to distinguish between IP packets with different priority levels.

D indicates that a lower delay is required.

T indicates a higher throughput requirement.

R indicates a higher reliability requirement.


Total length: The length of the message.

Identification: Because the datagram length exceeds the MTU (maximum transmission unit) of the transmission network and must be fragmented, the value of this identity field is copied to the identity field of all datagram fragments, making these fragments to be able to recreate the original datagram according to the contents of the Identity field when the final destination is reached.

Logo: The lowest bit is mf,mf=1, which means that there are fragments behind it.

When the middle bit is df,df=1, the expression cannot be fragmented.

Slice offset: In relation to the preceding data fragment, it is the offset shift of this fragment in the original data packet.

Lifetime: The time the datagram survives in the network, the maximum number of routers allowed through, not through a router, which automatically minus one, and if the value is 0, the router can discard the datagram.

Protocol: Indicates what protocol the datagram carries with the data, so that the IP layer of the destination host can know the number of processes that are reported to be submitted to (different protocols have a specially different process processing).

First check digit and: check operation on header.

Checksum method: At the transmitter, the IP datagram header is divided into several 16-bit binary sequences, and the first checksum field is set to 0, and all 16-bit sequence pairs are added with the inverse code operation, which will get a lot of

And the counter code writes the header checksum field. When the receiver receives the datagram, it organizes all the fields of the datagram header into a number of 16-bit binary sequences, which are added using the inverse code operation.

At once, the resulting results are reversed. If the result is 0, there is no error.


Source Address: The node address where the datagram is sent.

Destination Address: The node address that accepts the datagram.

                         

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.