What is the TCP/IP protocol?

Source: Internet
Author: User
Tags ftp file file transfer protocol ftp file transfer ftp file transfer protocol
What is the TCP/IP protocol?

This tutorial on TCP/IP is mainly considering that the Internet is almost entirely based on TCP/IP protocol, so what we should understand is what the TCP/IP architecture is. How it serves us. It becomes the foundation of what is called the "global Internet" or "Internet", which can connect most computers, no matter what operating system you use, the TCP/IP system is the fundamental cornerstone of Internet development in this century. To the network programmer, understand the mechanism of TCP/IP, can have constructs any network application basic element, what winsocket, serial communication and so on even Trojan, you will be solved.

One

First of all, the level of network protocols, network protocols are usually divided into different levels of development, each layer is responsible for different communication functions. A protocol family, such as T C p/i P, is a group of multiple protocols at different levels.

(1) The link layer, sometimes referred to as the data Link layer or network interface layer, usually includes the device driver in the operating system and the corresponding network interface card in the calculation. Together they handle details of the physical interface with the cable (or any other transmission medium).

(2) The network layer, sometimes called the Internet layer, deals with the activities grouped in the network, such as the selection of groups. In the T C p/i P Protocol Family, the network layer protocol consists of I p Protocol (Internet Protocol), I C m P protocol (i n T e R n e t internet Control Message Protocol), as well as I G M P protocol (i n T e R n e T Group Management Protocol).

(3) Transport layer, mainly for two host applications to provide end-to-end communication. In the T C p/i P Protocol family, there are two distinct transport protocols: T C P (Transmission Control Protocol) and U D P (User Datagram Protocol). T C p provides high reliability data communication for two hosts. The work it does involves dividing the data that the application gives to it into appropriate chunks to the network layer below, confirming the packets received, setting the timeout clock for sending the last confirmed packet, and so on. Because the transport layer provides high reliability end-to-end communication, the application layer can ignore all of these details. On the other hand, U D p provides a very simple service for the application layer. It simply sends packets called datagrams from one host to another, but does not guarantee that the datagram will reach the other end. Any required reliability must be provided by the application tier.

Application-level Telnet, FTP, and e-mail

Transport layer TCP and UDP

Network layer IP, ICMP, and IGMP

Link layer device driver and interface card

(4) Application layer, which is responsible for dealing with specific application details. Almost a variety of different T C p/i P implementations provide the following common applications:? Telnet remote login, FTP File Transfer Protocol, SMTP Simple Mail Transfer Protocol, SNMP Simple Network Management Protocol, now want to tell you that most of the network applications are designed as client-server mode on the same layer, both sides have a corresponding one or more protocols to communicate. For example, a protocol allows the T C p layer to communicate, while another protocol allows two I p tiers to communicate.

This actually means that the application layer itself does not pay attention to the transfer and exchange of data, it is generally just a user process, and the above I mentioned the transport layer and the following three layers of the purpose is to deal with the process of communication, they do not care about your application, the division of labor Clear.

Two

There is also a conceptual problem, we usually hear such as tcp,ip,ftp, and so on, in fact, the protocol itself is independent, TCP is the Transport layer protocol, IP is the network layer protocol T C p/i P Protocol Family is a group of different protocols combined together to form a protocol family. Although the protocol family is usually called T C p/i P, but T C P and I p are just two of these protocols (another name for the protocol family is I N T e R n e T protocol family (Internet Protocol Suite)) The purpose of the network interface layer and the application layer is obvious-the former handles there The details of the communication medium (Ethernet, Token Ring network, etc.), while the latter handles a particular user application (F t P, Te l n e T, etc.). However, on the surface, the difference between the network layer and the transport layer is not so obvious.

The simplest way to construct an interconnect is to connect two or more networks through a router. It is a special kind of hardware box used for network interconnection. The advantage of routers is to provide connectivity for different types of physical networks: Ethernet, Token Ring, point-to-point, and F D I (Fiber Distributed Data Interface) and so on. These boxes are also called the I P router (IP Router), but we use the term router (r o u T e r) here.

Historically, these boxes are called gateways (G a T e w a y) and are used in many T C p/i P Literatures.

The term gateway is now used only to represent application-layer gateways: a process that connects two different protocol families (for example, TCP/IP and IBM's SNA) for a particular application service (often e-mail or file transfer). In the T C p/i P protocol family, the network layer I p provides is an unreliable service. That is, it simply sends the packet from the source node to the destination node as quickly as possible, but does not provide any assurance of reliability. On the other hand, T C P provides a reliable transport layer on the unreliable I p layer. In order to provide this reliable service, T C p uses a mechanism such as timeout retransmission, sending and receiving end-to-end validation groupings. Thus, the transport layer and the network layer are responsible for different functions respectively. As for those mechanisms how to work, I also certainly do not know, hehe, have the hobby of telecommunication science friend can study in depth.

Three

Here is a new concept: multihomed, any system with multiple interfaces, English is called a multiple interface. You may be the same as I would ask: Our host is also a multi-interface, can be used as router. A host can also have multiple interfaces, but is not generally called a router, unless its function is simply to transfer packets from one interface to another. Similarly, routers do not necessarily refer to special hardware boxes that are used to forward packets in the Internet. Most of the T C p/i P implementations also allow a multiple interface host to function as a router, but the host must have a special configuration for this. In this case, we can call the system the main machine (when it runs an application, such as F t p or te l n e t), or it can be called a router (when it forwards packets from one network to another), using different terms in different contexts.

And then I said the bridge, another way to connect to the network is to use the Network Bridge. Bridge is the interconnection of the network on the link layer, while the routers are interconnected on the network layer. A network bridge makes multiple LANs (L a N) grouped together, which is like a local area network for the upper layer.

Four

TCP/IP tends to use routers rather than bridges to connect the network, so we will focus on the router, in fact, the main information is generally more focused on this, I can not save Ah, know friends do not doze. T C P and U D P are two of the most famous transport layer protocols, both of which use I p as Network layer protocol. Although T C p uses unreliable I p services, it provides a reliable transport layer service. I P is the main protocol on the network layer and is used by T C P and U D p. Each set of data for T C p and U D P is transmitted over the Internet through the end-to-end system and the I-P layer in each intermediate router. I C M P is a subsidiary agreement of the I-P agreement. The I p layer uses it to exchange error messages and other important information with other hosts or routers. I C M P is a subsidiary agreement of the I-P agreement. The I p layer uses it to exchange error messages and other important information with other hosts or routers. First of all, we have an impression of these agreements and we will continue to explore them later.

About IP address, I think should not say more, I p address long bit, we usually say that IP has three types of address format, in fact, a total of five categories: the first three categories I do not say, the most basic, now talk about Class D and Class E.

D:1 1 1 0 Then 28-bit multicast group number

E:1 1 1 1 0 back 27 left for later use

These 3 2-bit addresses are usually written in four decimal digits, each of which corresponds to one byte. This notation is called dotted decimal notation (dotted decimal notation). Again, the multi-interface host has multiple I-P addresses, each of which corresponds to an I-P address.

Since each interface on the Internet must have a unique I-P address, there must be a regulatory agency to allocate the I-P address for Internet access. This regulatory body is the Internet Information Center (Internet network informationc e n T r e), called i n T e r n i C. I n T e r n i c only assigns network numbers. The allocation of host numbers is the responsibility of the system administrator. There are three classes of I P addresses: a unicast address (intended as a single host), a broadcast address (the destination is all hosts on a given network), and a multicast address (all hosts in the same group as the destination), different from the above classification method.

Five

Domain Name resolution system (DNS): Although it is possible to identify the network interface on the host by using the I p address, the host name is preferred. In the field of T C p/i P, the Domain Name System (D N S) is a distributed database that provides mapping information between the I P address and the machine name

Six

Now talk about the encapsulation of TCP/IP: When the application uses T C p to transmit data, the data is fed into the protocol stack, and then each layer is passed through each tier until it is sent to the network as a stream of bits. Each of these layers adds some header information to the received data (and sometimes additional tail information), and the data unit that T C P passes to I p is called the T C P message segment or the T C P segment (t C Ps e g m e n T). The data unit that I p passes to the network interface layer is called the I P datagram (IP datagram). A bit stream transmitted over Ethernet is called a frame (Fr a M e).

More precisely, the data units that are transferred between the I p and the network interface layer should be grouped (p a C K e t). I think it can also be considered as a packet. The grouping can be either an I-P datagram or a slice of the I P datagram (F R A G m e N T), which I think is the most reasonable and careful explanation, and some of the domestic information is general here.

The U D p data is basically consistent with T C P data. The only difference is that the information unit that U d p passes to I p is called the U d P datagram (UDP datagram), and the first Minister of U D p is 8 bytes. Since t C p, U D p, i c M P and I G m P all have to transmit data to I p, so I p must add some kind of identification in the generated I P header to indicate which layer the data belongs to. For this purpose, I p deposits a number in the header with a length of 8 B I T, called the protocol domain. 1 is represented by the I C M P protocol, 2 is represented by the I G m P protocol, and 6 represents the T C P protocol, and 1 7 represents the U D P protocol. Similarly, many applications can use T C p or U D p to transfer data. Transport Layer protocol to deposit an application identifier when generating the message header. T C p and U D p all use a port number of 1 6 b i t to represent different applications. T C P and U D p put the source port number and the destination port number respectively in the message header. The network interface sends and receives the I P, a r p, and r a r p data separately, so you must also add some form of identification to the Ethernet frame header to indicate the network layer protocol that generates the data. For this reason, the Ethernet frame header also has a bit frame type field.

Seven

Now we talk about what is called Division, and the Division is actually a process of data transfer. Such a data transfer is a reverse process, the data began to rise from the stack from the bottom, while eliminating the protocol plus the message header. Each protocol box examines the protocol identifier in the header of the message to determine the upper layer protocol that receives the data. This process is called division (D e m u l t i p l e x i n g).

So that we can see more clearly. Not careful friends see no, here's IGMP and ICMP location, in fact they are encapsulated in the packet, and IP at the same level, is a subordinate protocol IP, do not confuse here.

I have said at the outset that most Web applications are designed to be the client and server side of this model. Specifically why I do not know, a little abstract: in order to adapt to certain specific services. There are two types of services that can be divided: duplicate or hairstyle. A repeating server interacts with the following steps: A repeating server interacts with the following steps:

I1. Waiting for the arrival of a customer request.

I2. Process customer requests.

I3. Sends a response to the customer who sent the request.

And the hairstyle server takes the following steps:

C1. Waiting for the arrival of a customer request.

C2. Start a new server to process the client's request. During this period, a new process, task, or thread may be generated and dependent on the support of the underlying operating system. How this step is performed depends on the operating system. The new server that is generated handles all requests for the customer. Terminate this new server after processing is complete.

C3. Returns c 1 steps. And the hairstyle server takes the following steps:

C1. Waiting for the arrival of a customer request.

C2. Start a new server to process the client's request. During this period, a new process, task, or thread may be generated and dependent on the support of the underlying operating system. How this step is performed depends on the operating system. The new server that is generated handles all requests for the customer. Terminate this new server after processing is complete.

C3. Returns c 1 steps.

In general, the T C P server is concurrent, while the U D P server is duplicated, but there are some exceptions.

Data from: E NET. Silicon Valley Power

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.