Understanding of the TCP/IP protocol

Source: Internet
Author: User
Tags representational state transfer ftp protocol

Say two computers to communicate must abide by the common rules, just like two people to communicate must use a common language. A person who knows only English, and a person who only knows Chinese is not able to communicate because there is no common language (rules). The rules of communication between two computers are the network protocol.


So who's going to make this network protocol?


The International Organization for Standardization (ISO) defines the basic framework of network protocols, known as the OSI model. To make communication rules, the content will be many, for example, to consider how a computer to find B computer, a computer in the transmission of information to B computer when the B computer to give feedback, a computer to B computer data format is how? Too much content is too miscellaneous, so the OSI model divides these communication standards into layers, each of which solves a category of problems, making it less complex to make standards. The seven-tier standard models developed by the OSI model are: Application layer, presentation layer, session layer, Transport layer, network layer, data link layer, physical layer.


Although the International Organization for Standardization has developed a model of such a network protocol, the network protocol used by Internet communication is actually TCP/IP network protocol.


TCP/IP is a protocol family and is divided by hierarchy. Total four layers: application layer, Transport layer, interconnect network layer, network interface layer. So what is the difference between the TCP/IP protocol and the OSI model? The OSI network protocol model is a reference model, and the TCP/IP protocol is the de facto standard. The TCP/IP protocol refers to the OSI model, but it is not strictly in accordance with the OSI specification of the seven layer to divide the standard, and only divided four layers, the individual think it will be more simple, when the division of too many levels, you can hardly distinguish between the level of a protocol. The TCP/IP protocol and the OSI model also do not conflict, the application layer protocol in the TCP/IP protocol corresponds to the application layer in the OSI, the presentation layer, the session layer. Just like before the Ministry of Industry and Information Industry department, now implement a large ministry of Industry and Information Technology department only a department, but this department is to do the previous two departments as many things, essentially not much difference. There are two important protocols in TCP/IP, the TCP protocol of the Transport Layer and the IP protocol of the interconnection Network layer, so the two protocols are represented to name the whole protocol family, which refers to the whole protocol family when the TCP/IP protocol is said.


The TCP/IP protocol is divided into four levels, but we do not need to understand all levels of the protocol, I think the main focus on the application layer and Transport layer of the Protocol is possible. Send mail for example, a mail to b,a care about what format to write what content to B (Application layer content), is to send a registered letter or send a regular mail (Transport layer content), but a is not to pay attention to the mail transmission process used in which route, the postman is how to deliver the letter to the B hand (interconnection network layer, Network interface layer).


First, the transport layer, the transport layer has more than one protocol, but the most important is the TCP and UDP protocol. The difference between the two is that the TCP protocol requires receiver feedback, and the UDP protocol does not require receiver feedback. TCP is like a registered letter, a computer sends a message to B computer, need to get B computer feedback, so a computer can know whether B computer has received information. UDP is like regular mail, a computer to send information to B computer, B computer does not give a computer astounding, a computer send information out after not know whether B computer has been received. Therefore, TCP transmission is more reliable than UDP delivery, but TCP transmission is less efficient than UDP. As for, in the transmission process of the specific choice of transmission mode, the specific problem needs specific analysis. TCP transmission is generally selected during unreliable network transfers. In the case of efficiency, or do not care about transmission errors can choose the UDP mode to improve the transmission rate.


There are many protocols to the application layer, and each one represents a type of service. HTTP protocol: World Wide Web Service. FTP protocol: File transfer service. POP3: Mail Service, SOAP protocol: WebService service.


In the process of understanding the TCP/IP protocol, I encountered three puzzles.


1. What is a socket?


I have heard about socket programming before, and some say socket programming. When I search the data about the socket, I find that the socket refers to a connection, and some say that the socket refers to an endpoint. Take the phone analogy, a telephone and b telephone is talking, then the socket refers to the connection between A and B floss, or the telephone (end point)?


I now understand that the socket is an endpoint in a connection, a single communication (connection), a, a, a socket. A socket corresponds to a connection.


Does the 2.http protocol belong to the application layer or the transport layer?


HTTP Hypertext Transfer Protocol, which sounds like a Transport layer protocol. But in fact, we all know that HTTP and FTP are the same as the application layer of the Protocol, I was very puzzled, since it is the application layer of the Protocol, how to take such a misleading name AH. It's easy to misunderstand and wonder when you're not familiar with the TCP/IP protocol. Later, I found this passage on the wiki:


HTTP Chinese Translation problem


HTTP is translated as "Hypertext Transfer Protocol" in mainland China because "transfer" has the meaning of "transmission" in Chinese. But according to Dr. Roy Fielding, one of the HTTP Customizer's papers [1] (6.5.3), the author specifically emphasizes that "transfer" represents "transfer" (representational state transfer) rather than "transfer "(transport). Therefore, the Chinese translation of the "Hypertext Transfer Protocol" is precisely introduced to reflect this misunderstanding. More in line with Literal's translation should be "Hypertext transfer agreement."


This passage relieved me of my doubts. The HTTP protocol is, of course, an application-level protocol.


Can 3.SOAP be transmitted using the HTTP protocol?


In the process of understanding the SOAP protocol, we see that soap can be transmitted through the TCP,UDP,HTTP protocol. This is also a confusing description. A look at this sentence, you will feel how the HTTP and the TCP,UDP protocol is tied up? Does HTTP still belong to the Transport layer protocol? In addition to the HTTP Chinese translation of the problem, the name sounded like a transport layer, beginners will start again big head.


In fact, HTTP is an application-level protocol, which can be no doubt. So now the new question is coming. Soap and HTTP are application-layer protocols, how can soap be transmitted using the HTTP protocol? Can the protocol of the application layer be routed using the protocol of the application layer?


I looked up the information, this is the case, SOAP will be XML serialization of information, and then the HTTP protocol in the manner of re-packaging for transmission, the way of transmission is TCP or UDP. A metaphor is a good idea. Both TCP and UDP are highways, and for the moment TCP is considered a general highway, UDP Highway, SOAP and HTTP are all cars, then both soap and HTTP can run on TCP and UDP. Said soap can be transmitted via HTTP, which is actually said that soap is a car, HTTP is a car truck, the SOAP information into the HTTP, and then transport, of course, the road is still TCP or UDP.


Said soap can be transmitted through the HTTP protocol, this sentence is not very accurate, more accurate: The SOAP message can be wrapped through the HTTP protocol via TCP or UDP transmission.

Understanding of the TCP/IP 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.