HTTP protocol and XMPP protocol

Source: Internet
Author: User
Tags http request wrapper

Application layer protocol: Each application tier is designed to solve a class of application problems. The solution of the problem must be accomplished through communication and collaboration between multiple application processes located in different hosts. Strict rules must be observed between application processes. Application-layer protocols should be defined as follows: the types of messages exchanged between application processes, such as the individual fields in the request message and response message messages and the meaning of the information contained in the field, and the rules for how the process, how to send the message, and the response to the message

1.HTTP Protocol
The World Wide Web uses a Uniform Resource locator URL to flag various documents on the World Wide Web and to have each document have a unique identifier URL throughout the Internet, and the World Wide Web client and server programs must adhere to the strict protocol, HTTP protocol. The HTTP protocol is an application-layer protocol that uses TCP connections for reliable delivery. In addition, Hypertext Markup Language HTML is used to extract display documents
1.1 HTTP Operation Process

1.2 Users click on a page of Firefox browser to trigger the event browser analysis link to the URL of the page to the DNS request resolution URL for the IP address domain Name System resolves the IP address of the browser and the server to establish a TCP connection (server-side port is 80) The browser issued a get file command The server responds to the GET request and sends the file index.html to the browser to release all text information from the TCP link browser that displays index.html

The 1.3 HTTP protocol uses connection-oriented TCP as the Transport Layer protocol
Ensure the reliable transmission of data. HTTP does not have to consider how the data will be re-transmitted when it is dropped in transit. But the HTTP protocol itself is non-connected, which means that both parties do not need to establish an HTTP link before exchanging HTTP messages.
The HTTP protocol is stateless , and the server does not remember the user that was once visited.

1.4 HTTP1.0 and HTTP1.1 HTTP1.0 disadvantage: Twice times the cost of RTT per request for a document. If there are many linked objects on a home page that need to be connected, 2*rtt time is required for each connection download. Another cost is that the World Wide Web client and server are allocating caches and variables each time a new TCP connection is established. Using a no-TCP connection can shorten the response time.

The HTTP1.1 protocol is a good solution to this problem. He used a persistent connection. The World Wide Web server still maintains this connection for a period of time after the response is sent, and the same customer and the server can continue to transmit subsequent HTTP request messages and response messages on this connection.

There are two ways to work with the HTTP1.1 continuous connection. Pipeline and non-assembly line.

1.4 HTTP Message Structure request message Response message

Three components, the difference between the two message formats is the start line different start line, used to distinguish whether the request message (request line) or response message (status line) header row entity body

method of requesting a message:
Get request gets the resource identified by the Request-uri
Post appends new data to the resource identified by Request-uri
HEAD request Gets the response message header for the resource identified by Request-uri
PUT Request server stores a resource and uses Request-uri as its identity
Delete Request server deletes the resource identified by the Request-uri
TRACE requests the server to echo received request information, primarily for testing or diagnostics
CONNECT reserved for future use
Options request the performance of the query server, or query for resource-related choices and requirements

Characteristics of response messages
The first line is the status line, which includes three items, the version of HTTP, the status code, and the closing
1XX indicates notification information, request processing
2XX indicates successful request
3XX indicates redirection
4XX indicates client error
5XX indicates server error

2. XMPP protocol
XMPP is a kind of data transmission protocol, which is similar to the HTTP protocol, its process is like "wrapper –〉 wrapper" process, the user only need to understand the type that it accepts, and understand the type that it returns, can make good use of XMPP for data communication. Extensible Markup Language (XML)-based protocol
basic network structure of 2.1XMPP
Client Server Gateway
Communication can occur bidirectional between any two of these three. The server also assumes the client information record, connection management and information routing function. The gateway undertakes the interconnection with the heterogeneous instant communication system, and the heterogeneous system can include SMS (SMS), MSN,ICQ and so on. The basic network form is that a single client connects to a single server over TCP/IP and then transmits the XML over it.

2.2 XMPP Working principle

The basic mode of the XMPP core protocol communication is to build a stream first, then negotiate a bunch of security and other things, the intermediate communication process is the client sends XML Stanza, one by one. The server sends XML stanza to the client based on the information sent by the client and the logic of the program. But this process is not a question and answer, and at any time it is possible to send a letter from one party to another. The final phase of communication is to close the stream and close the TCP/IP connection.

2.3 The details of the communication primitives are not summed up. You can refer to this person.
http://blog.csdn.net/imyfriend/article/details/8584360

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.