Introduction to the TCP/IP protocol of the basic application layer (IP/TCP/UDP)

Source: Internet
Author: User

 

Introduction to the TCP/IP protocol of the basic application layer (IP/TCP/UDP)

Source: http://www.networkdictionary.com/chinese/protocols/tcpip.php

 

IP/IPv4: Internet Protocol

IP/IPv4: Internet Protocol
  (IP/IPv4: Internet Protocol)

An Internet Protocol (IP) is a network layer protocol that contains addressing information and control information, allowing data packets to be routed over the network. The IP protocol is the main network layer protocol in the TCP/IP protocol family. It is a core protocol that combines with the TCP protocol to form the entire Internet protocol. The IP protocol is also applicable to LAN and WAN communication.

The IP protocol has two basic tasks: Providing connectionless and most effective data packet transmission, and splitting and reorganizing data packets to support data connections of different maximum transmission units. There is a complete set of IP address addressing methods for Route Selection and processing of IP datagram in the interconnected network. Each IP Address has a specific structure but follows the basic format. IP addresses can be subdivided and used to create subnet addresses. Each computer in the TCP/IP network is assigned a unique 32-bit logical address, which is divided into two main parts: the network number and the host number. The network number is used to confirm the network. If the network is part of the Internet, the network number must be uniformly allocated by InterNIC. An ISP can obtain a network address from InterNIC and allocate the address space as needed. The host number confirms the host in the network, which is assigned by the local network administrator.

When you send or receive data (for example, an email or webpage), a message is divided into several blocks, that is, what we call a "package ". Each package contains both the network address of the sender and the address of the receiver. Because messages are divided into a large number of packets, each packet can be sent through different network paths if needed. When packets arrive, the order is different and the sending order is the same. The IP protocol is only used to send packets, while the TCP protocol is responsible for sorting packets in the correct order.

Except ARP and RARP, all other protocols in the TCP/IP family use IP addresses to send communications between hosts. The current IP protocol has two versions: IPv4 and IPv6. This article mainly describes IPv4. IPv6 details will be introduced in other files.

Protocol Structure

4 8 16 32bit
Version IHL Type of service Total Length
Identification Flags Fragment Offset
Time to live Protocol Header checksum
Source Address
Destination Address
Option + padding
Data

  • Version-4 fields, indicating the current IP version.
  • IP header length (IHL)-It indicates the length of the protocol header, with 32 characters. Point to the data start point. The minimum value of the correct protocol header is 5.
  • Type-of-service-indicates the quality of service that the upper-layer protocol expects to process the current datagram, and allocates the datagram according to the importance level. These 8-bit fields are used to assign priority, latency, throughput, and reliability.
  • Total length-specify the length of the entire IP packet in bytes, including the data and protocol header. The maximum value is 65,535 bytes. A typical host can receive 576-byte data packets.
  • Identification-contains an integer used to identify the current datagram. This field is allocated by the sending end to help the receiving end to centralize the datagram sharding.
  • Flags consists of three fields. The lower two fields (least important) control the shard. Indicates whether data packets can be sharded. The intermediate bit indicates whether the packet is the last shard in a series of multipart data packets. The third digit means that the highest digit is not used.
  • Fragment Offset-13-bit field, which indicates the shard data location related to the start end of the source datagram, and supports the proper reconstruction of the source datagram from the target IP address.
  • Time-to-live is a counter. Each vertex value of the discarded datagram is reduced by 1 until it is reduced to 0. This ensures the endless loop process of data packets.
  • Protocol-specifies the upper-layer protocol that receives imported data packets after the IP address processing is completed.
  • Header checksum-helps ensure the integrity of the IP protocol header. Due to changes in some protocol header fields, such as time to live, each vertex needs to be re-computed and tested. The Internet protocol header must be processed.
  • Source Address-specify the sending code.
  • Destination Address-specify the receiving code.
  • Options-Allow IP addresses to support various options, such as security.
  • Data-including upper-layer information.

Protocols IPv6, TCP, UDP, ICMP, SNMP, FTP, telnet, SMTP, ARP, RARP, RPC, XDR, NFS
Organization Source IP is defined by IETF (http://www.ietf.org) in RFC 791.
Related Links Http://www.javvin.com/protocol/rfc791.ications: Internet protocol specifications
Http://www.cisco.com/univercd/cc/td/doc/cisintwk/ito_doc/ip.htm: IP Overview

 

TCP: Transmission Control Protocol

TCP: Transmission Control Protocol
  (TCP: Transmission Control Protocol)

Transport Control Protocol (TCP) is the transport layer protocol in the TCP/IP protocol stack. It provides reliable data stream transmission and virtual connection services to applications through the sequence validation and packet re-transmission mechanism. Combined with the IP protocol, TCP forms the core of the Internet protocol.

Since most network applications run on the same machine, the computer must be able to ensure that software programs on the machine at the destination can obtain data packets from the machine at the source address, and the source computer can receive the correct response. This is done by using the TCP "port number. The network IP address and port number are combined into a unique identifier, which is called "socket" or "endpoint ". TCP establishes a connection or virtual circuit between the endpoints for reliable communication.

The TCP Service provides data stream transmission, reliability, effective traffic control, full duplex operations, and Multiplexing technologies.

For stream data transmission, TCP delivers a non-structured byte stream defined by the serial number. This service is advantageous to the application because the application does not need to divide the data into blocks before it is sent to TCP. TCP can combine bytes into fields and then send the data to the IP address for sending.

TCP ensures reliability through connection-oriented, end-to-end reliable datagram transmission. TCP adds a progressive validation serial number to the byte to tell the receiver the next byte that the sender expects to receive. If no response to this package is received within the specified time, resend the package. TCP's reliable mechanism allows devices to process lost, delayed, duplicated, and read-error packets. The timeout mechanism allows devices to monitor lost packets and request re-sending.

TCP provides effective traffic control. When a confirmation response is returned to the sender, the receiving TCP process indicates the highest serial number that can receive and ensure that the cache will not overflow.

Full-duplex operation: the TCP process can send and receive packets simultaneously.

Multiplexing Technology in TCP: a large number of concurrent upper-layer sessions can be multiplexing on a single connection.

Protocol Structure

16 32 bit
Source Port Destination Port
Sequence Number
Acknowledgement number
Offset Reserved U A P R S F Window
Checksum Urgent Pointer
Option + padding
Data

  • Source Port-identifies the point where the upper-layer source processor receives the TCP Service.
  • Destination Port-identifies the point at which the upper-layer target processor receives the TCP Service.
  • Sequence Number-the sequence number of the first byte of the Data allocated to the current information. In the connection establishment phase, this field is used to set the initial serial number in the transmission.
  • Acknowledgment number-the serial number of the next byte of the data that the data packet sender expects to receive. This value is always sent once the connection is successful.
  • Data offset-4 bits. The 32-bit serial number in the TCP header indicates the start position of the data.
  • Reserved-6 bits. Reserved for backup, must be set to 0.
  • Control bits (flags)-6 bits. Transmit various control information. The control bit can be:

U (URG) Urgent Pointer field significant.
A (ACK) Acknowledgment field significant.
P (PSH) Push function.
R (RST) Reset the connection.
S (SYN) Synchronize sequence numbers.
F (FIN) No more data from sender.

  • Window-16 bits. Specify the size of the Receiving Window of the sender, that is, the size of the Eight-bit cache zone available for data.
  • Checksum-16 bits. Indicates whether the protocol header is damaged during transmission.
  • Urgent Pointer-16 bits. Point to the first important Data byte in the data packet.
  • Option + padding-specify various TCP options. There are two possible options: an eight-bit (Optional) Type and an eight-bit (Optional) Type, an eight-bit (optional) length, and an actual eight-Bit Data Group.
  • Data-contains upper-layer information.

Protocols IP, UDP, ICMP, SNMP, FTP, telnet, SMTP, RPC, XDR, NFS
Organization Source TCP is defined by IETF (http://www.ietf.org) in RFC 793.
Related Links Http://www.javvin.com/protocol/rfc793.133: TCP specifications
Http://www.javvin.com/protocol/rfc?8.=: the addition of Explicit Congestion Notification (ECN) to IP
Http://www.iana.org/assignments/port-numbers: TCP and UDP port numbers

 

UDP: User Datagram Protocol

UDP: User Datagram Protocol
  (UDP: User datemediprotocol)

User Datagram Protocol (UDP) is a connectionless transport layer protocol in the ISO reference model. It provides a simple and unreliable information transmission service for transactions. UDP is basically an interface between the IP protocol and the upper-layer protocol. The applicable port of UDP Protocol identifies multiple applications running on the same device.

Since most network applications run on the same machine, the computer must be able to ensure that software programs on the machine at the destination can obtain data packets from the machine at the source address, and the source computer can receive the correct response. This is done by using the UDP port number. For example, if a workstation wants to use the Domain Name Service System on the workstation 128.1.123.1, it will give the data packet a destination address 128.1.123.1 and insert the destination port number 53 in the UDP header. The source port number identifies the application of the local machine requesting the Domain Name Service. At the same time, you need to specify all the response packets generated by the destination site to this port of the source host. For more information about UDP ports, see related articles.

Unlike TCP, UDP does not provide reliable IP protocol mechanisms, stream control, and error recovery functions. Because UDP is relatively simple, the UDP header contains a few bytes, which consumes less than the TCP load.

UDP is applicable when TCP reliability is not required. For example, when a high-level protocol or application provides error and flow control functions. UDP is a transport layer protocol and serves many well-known application layer protocols, including Network File System (NFS), Simple Network Management Protocol (SNMP), and Domain Name System (DNS) and a simple File Transfer System (TFTP ).

Protocol Structure

16 32bit
Source Port Destination Port
Length Checksum
Data

  • Source Port-16 bits. The source port is an optional field. When used, it indicates the sender's port, and it is considered to be a reply port that needs to be addressed if there is no other information. If not, set the value to 0.
  • Destination Port-16 bits. The destination port is meaningful when the destination address of the Internet is special.
  • Length-16 bits. The eight-bit length of the User Datagram, including the protocol header and data. The minimum length is 8.
  • Checksum-16 bits. IP protocol header, UDP protocol header, and data bit, and finally the sum of false information protocol headers filled with 0. If necessary, it can be composed of two octal digits.
  • Data-contains upper-layer data information.

Protocols IP, TCP, ICMP, SNMP, DNS, TFTP, NFS
Organization Source

UDP is defined by IETF (http://www.ietf.org) in RFC 768.

Related Links

Http://www.javvin.com/protocol/rfc768.pdf:User datemediprotocol (UDP) Specifications
Http://www.iana.org/assignments/port-numbers:UDP and TCP port numbers

 

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.