TCP/IP protocol and initial understanding

Source: Internet
Author: User

    1. TCP/IP is a shorthand for transmission Control protocol/internet Protocol, which is the transmission Protocol/Internet Protocol.

A) The protocol structure includes the link layer, the network layer, the transport layer, the application layer.

1) The link layer is primarily responsible for the physical device characteristics, receiving data.

2) The network layer is primarily responsible for the IP header package of the transport layer data, sending data to the network interface to see if the IP header receives data or continues to transmit data.

3) The Transport layer is responsible for the application 3 times handshake and 4 disconnects.

One handshake: The client sends a serial number (for example, m) to the server.

Two-time handshake: The server receives (m) and sends the serial number (M+1,N).

Three-time handshake: The client receives (M+1,N) and sends the serial number (N+1) to establish the connection.

4 times the same principle, why 4 times because the client and the server have two connections.

4) The application layer is primarily responsible for the application connection.

2. The application data is processed by the application protocol, arrives at the Transport Layer encapsulation TCP header, arrives at the Network Layer encapsulation IP header, to the link layer.

IP header Format

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6E/B6/wKiom1WDjbaQAlTsAABjaaNHYLQ008.gif "title=" 4136720.gif "alt=" Wkiom1wdjbaqaltsaabjaanhylq008.gif "/>

The version number 4 bits represents the IPv4 protocol, and the two versions of the communication are consistent.

The header length is 32bit, so the maximum length is 60 bytes, and when the header length of the IP packet is not an integer multiple of 4 bytes, it must be populated with the last fill field.

The service type primarily defines the priority of the service.

The total length indicates the length of the header and the sum of the data, in bytes and maximum 65535.

The link layer has the transmission maximum unit, when the data is larger than this unit, need to fragment, the value of this identity is copied to all the data Sheet representation field, The identifier can indicate which packets are in one data.

3-bit flag The first identifier is useless, the second digit indicates if 1 is not segmented, the third digit indicates if 0 represents the last segment of the data.

The slice offset represents the position of the data segment in the data.

Time-to-live data is passed through the number of times to prevent an infinite loop, after a route value minus one, 0 o'clock discards the data.

The protocol defines the type of upper layer protocol, and 6 represents the TCP protocol.

Verify and detect the correctness of IP header.

32 optional options are not fixed

The bottom of the options is padding, and the completion data is an integer multiple of 4 bytes.

TCP Header

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6E/B3/wKioL1WDmVyht8tKAAGlYZu0acg318.jpg "title=" 20130712125927-713563634.jpg "alt=" wkiol1wdmvyht8tkaaglyzu0acg318.jpg "/>

Source port, and source IP indicates the data return address.

Destination Port Destination Ports

Sequence Number data message The first byte of a sequence

Acknowledgment number wants to receive the first of its own serial numbers for the next segment of data.

Data offset indicates the starting date, from the TCP first ministerial degree, in units of 4 bytes.

Reserved reserved area.

Urg emergency bits, data to be delivered as soon as possible.

ACK Acknowledgement bit, 1 indicates the data is valid.

PSH push Bits, commit now.

PST reset bit, data transfer error, need to reestablish connection.

SYN synchronous bits, which synchronize serial numbers when the connection is established.

Fin terminates the bit, 1 o'clock indicates the data transfer is complete and the connection is released.

window receives the size of the windows.

Checksum checksum, data correctness.

Urgent pointer emergency pointer, serial number to the emergency pointer between the emergency data, the pointer is normal data, provided that Urg is valid for 1 o'clock.

Options are variable in length. The first byte defines the option type, which is a multiple of 4 bytes.

The Padding padding TCP header length is a 4-byte integer.


TCP/IP protocol and initial understanding

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.