TCP/IP protocol stack for communication protocol

Source: Internet
Author: User
Tags ftp protocol

Note: The content of this article comes from the Netizen God, as the study note record in this. If there is a similar, please understand;

The TCP/IP protocol stack is divided into four layers: application layer, Transport layer, network, data link layer, each layer has corresponding protocol;

The so-called protocol: is a format for both parties to transmit data. There are many protocols used throughout the network, and fortunately, each protocol has RFC documentation.

Let's take a look at the format of a frame Ethernet packet:

First, the TCP protocol

The TCP protocol is in the transport layer. Connection-oriented (connect first), so high reliability (no loss of data, no data out of sequence, no data errors, no duplication of data arrival) transmission protocol.

Second, UDP protocol

Same level as TCP. No connection, no guarantee of reliable transport layer protocol.

Third, IP protocol

IP is the most important protocol in the family of TCP/IP protocols. All TCP, UDP, ICMP, and IGMP data are transmitted in an IP datagram format. His features are as follows:

    • Not reliable. IP datagrams cannot be guaranteed to reach their destination successfully. IP only provides the best transport service. If some kind of error occurs, e.g. a router is temporarily running out of buffers, and IP has a simple error-handling algorithm: Discards the datagram and sends an ICMP message to the source. The reliability of any requirement must be provided by the upper layer (for example, TCP).
    • No connection. IP does not maintain any status information about subsequent datagrams. The processing of each datagram is independent of each other. It is also stated that IP packets can not be received in the order in which they are sent. If a source sends two consecutive datagrams (A, b) to the same beacon, they are routed independently, possibly different routes, and B may arrive before A.

The next step is to introduce the detailed header format:

1. IP message Format

IP protocols are often encapsulated in Ethernet frames for transmission. All TCP, UDP, ICMP, and IGMP data are encapsulated in an IP datagram.

The following is the IP header (header) format:

    • Version field (4bits): currently ipv4,0100
    • Header Length (4bits): Used to indicate the length of the header. 0-15, this refers to the unit is a 32-bit word (that is, 4 bytes), so the maximum length is 15*4=60byte = 480bits.
    • Service type (8bits): 1-3bit is the priority sub-segment, which is now ignored; 4-7bit: represents latency, throughput, reliability, and cost, respectively. A value of 1 indicates the minimum delay, maximum throughput, maximum reliability, and minimum cost, respectively. The four can only have a maximum of 1 bits of 1, corresponding to indicate how the datagram is transmitted by the network system to deal with. Can be all zeros, indicating a General Service. For example: The Telnet protocol requires minimal latency, and the FTP protocol data may require maximum throughput. There are no special requirements for the ICMP protocol (4 bits are all 0). In general, the main opportunity ignores these fields, and the dynamic routing protocol makes routing decisions based on the values of those fields.
    • Total Length field (16bits): Indicates the length of the entire datagram, in bytes, with a maximum length of 65535 bytes
    • Flag field (16bits): Used to uniquely identify each datagram sent by the host. Usually each send a message, its value is + 1;
    • Flag bit field (3bits): Flag whether a datagram requires fragmentation.
    • Segment offset field (13bits): If a datagram requires fragmentation, this field indicates the position of the segment offset from the beginning of the original datagram.

TCP/IP protocol stack for communication protocol

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.