JavaScript hodgedge 0

Source: Internet
Author: User

1. Protocol Summary: HTTP and TCP/IP protocols

The foundation of modern Web application development is the HTTP protocol. What is the relationship between the HTTP protocol and the well-known TCP/IP protocol?

This should begin with the network communication model. Simply put, computer communication is like two people communicating with each other. How can we understand each other? It is easy to use consistent languages and expressions.

The language for communication between computers is the network protocol. Network protocols are a set of communication rules between all devices on the Network (network servers, computers, switches, routers, firewalls, etc, it specifies the format required for communication and the meaning of these formats. Most networks adopt a layered architecture. For example, in the traditional Open System Interconnection Reference Model (OSI), seven layers of models are defined, from bottom to top: physical layer, data link layer, network layer, transmission layer, Session Layer, presentation layer, and application layer. Each layer is built on its lower layer to provide certain services to its upper layer, and blocks the details of how to implement this service from the upper layer. The rules for communication between layer n on one device and layer n on the other device are layer n protocol. There are many protocols in each layer of the network. The protocol between the receiver and the sender must be the same. Otherwise, one party cannot identify the information sent by the other party. The network protocol enables various devices on the network to exchange information with each other. Common protocols include TCP/IP, IPX/SPX, and NetBEUI.

The three common protocols have different characteristics, which leads to different applicability. The most suitable for use on the Internet is the TCP/IP protocol. The protocol system does not use the traditional layer-7 protocol. Instead, it proposes a simplified layer-4 model, from bottom to top: network interface layer, network layer, transmission layer, and application layer. Similarly, computers in the network can communicate with each other only by defining communication protocols for each layer. For example, the IP coroutine at the network layer, the FTP, UDP, and TCP Protocols at the transmission layer, and the HTTP, SMTP, POP3, FTP, and TELNET protocols at the application layer.

HTTP is an application layer protocol called Hypertext Transfer Protocol. It is a protocol that provides Web Services. Web pages cannot be browsed without the HTTP protocol, but other email services (as long as the Protocol is present) are still normal.

2. Request Process: HTTP request

We access the website in a browser and interact with the server through HTTP requests. When you click a connection, the browser first finds the IP address of the site (implemented through DNS ). After finding the IP address, establish a TCP connection. After the connection is established, we can send the request. Each interaction is converted into an HTTP request, such as GET (first request page), HEAD, POST (with parameters, request page), and PUT. The converted HTTP request has a certain format. If you are interested, refer to the corresponding HTTP request format description.

After the server completes processing the request, it will return an HTTP Response to the client and disconnect the connection. This response also contains a lot of information. After the browser receives the response, it parses the response and displays it in the browser. The most useful response content is the response status (represented by numbers, such as 200 indicating success, 404 indicating that no page is found) and various texts (such as HTML and CSS files on pages) that return requests, javaScript files ).

3. HTML language

After obtaining HTML from the server, the browser is responsible for interpreting and displaying HTML content. HTML stands for hypertext markup language. its initial purpose is to format the text, facilitate browser interpretation, and display it to the client. However, with the development of the network, the content transmitted and displayed over the network is also becoming more and more abundant. The page does not only contain static images and texts, but also includes lists, options, and interactions. The expanded HTML provides richer tags. The most prominent is the <form> form, which is the prerequisite for applications to interact with users. <Form> the form prompts the browser. The content between the label and </form> label is returned to the server. The form data will be "shipped" to the server for processing. This process is sending back.

A typical HTTP request is usually a GET request first, and then a POST request-the former obtains the original document, and the latter is used to return data to the server when necessary, for more complex computing and processing.

Directly Using HTML development is undoubtedly very troublesome. In order to better complete modern dynamic Web development, different companies provide different runtime environments and development tools. Microsoft provides ASP. NET. It provides many integrated objects, simplifying development. However, there are still many problems that cannot be well solved. For example, HTTP is stateless, and it is really difficult to maintain the status before and after page POST.

4. Web development ideas

From the above analysis, we can see that in the final analysis, Web development is nothing more than dealing with two major problems:

(1). manage user interfaces through HTML on the connectionless HTTP protocol

(2) Manage the application status on stateless HTTP protocol.

Although the emergence of frameworks such as ASP makes Web development easier, developers still need to develop many "standard" functions on their own, such as security systems and UI status management, data access. All this promotes the generation of more advanced and intelligent programming frameworks such as ASP. NET.

After understanding this basic problem and making developer development faster and simpler, we can imagine that the specific development framework will continue to develop and innovate, and provides more complete and intelligent functions.

Of course, the emergence of WebSocket in HTML5 has triggered a connection status, which has been mentioned in the previous article.

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.