Easy Tutorial
❮ Verilog Serial Fir Verilog2 Udp ❯

7.1.1 Android Network Programming and Http Protocol Learning

Category Android Basic Tutorial

Introduction to This Section:

>

Unconsciously, we have finally arrived at the section on Android network programming. What we have been playing with before is all standalone, which is definitely not satisfying, right? Starting from this section, let's learn about some things related to Android network programming: what should Android end network programming do? Learning of the Http protocol, using the built-in Json parsing class to parse Json, several common ways of XML parsing, the use of HttpUrlConnection and HttpClient, file uploading, downloading; the use of WebService, WebView, and the use of Socket communication, etc.!

In addition, we are the client side, and the content of the server side is not within our scope, and Xiaozhu is not good at it. Our minimum requirement is: to be able to master the ability to obtain and parse the data feedback from the server! Well, let's not say much, let's start the content of this section!


1. Three Ways of Interaction between Android and the Internet


2. First Understanding of the Http Protocol

>

In actual development, we usually use communication based on the Http protocol when dealing with the server side, so learning the Http protocol is very important. Of course, we don't need to be too particular about some details, just have a general understanding! They are all some conceptual things!


1) What is the Http Protocol?

>

Answer: hypertext transfer protocol (hypertext transfer protocol), an application layer protocol of the TCP/IP protocol, used to define the process of exchanging data between WEB browsers and WEB servers. After the client connects to the web server, if you want to obtain a certain web resource in the web server, you need to follow a certain communication format. The HTTP protocol is used to define the format of communication between the client and the web server.

2) The Difference between Http 1.0 and Http 1.1

>

Answer: The 1.0 protocol, after the client establishes a connection with the web server, can only obtain a web resource! And the 1.1 protocol allows the client to obtain multiple web resources on a connection after establishing a connection with the web server!

3) The Underlying Workflow of the Http Protocol:

>

Answer: We first need to know two terms:

Then it's the concept of TCP/IP three-way handshake:

If it's still not very clear, let's take a look at the schematic diagram of the three-way handshake:

Understood, right? Then let's take a look at the process of an Http operation:

If the above process is still not clear, we can use HttpWatch or Firefox to grab the package: PS: The test site is the teaching system of Xiaozhu's school. After entering the account password, request login, and we can see the following information:

Contents included in HTTP request:

❮ Verilog Serial Fir Verilog2 Udp ❯