Mobile Server micro-architecture design and implementation topics

Source: Internet
Author: User

9.29

began to look at the web video to learn the mobile server micro-architecture implementation, the reason is:

Now you want to learn more about Android's basic network knowledge, and its practice

I. Knowledge PREPARATION

First, I want to understand the relationship between TCP, UDP, and HTTP, and find out under what circumstances I need to choose which.

Then, what I need to know is how HTTP is implemented. It is said that this is the interview we may need to test, in fact, what I need is to clarify

What needs to be done by request and accept

Finally, the parsing process for HTTP.

Two. Writing the code process

The next step is to write the code along with the video:

The first is to set the accept socket, the core of the server.

In this process, the asynchronous process of accepting information is activated.

Accept the socket procedure

1. Define address, class is inetsocketaddress, pass the address that has been written to go in

2. Define the transmitter for the remote client, serversocket.accept ()

3. Activate the thread pool to perform the process of processing information after the client sends the message to the server.

Parsing the headers process

1. Once the information has been received, it is necessary to understand the process of processing the headers. First, understand the HTTP protocol

In fact, header==value between, there is a \ r \ n separated.

Splitting information into storage

1.url routing, at the beginning I do not understand, and later learned that the server is based on the received domain name, select the corresponding processing method.

Then each processing method needs to be registered in the main program, easy to use.

Then, according to the division of a domain name, to find the corresponding method.

Via WiFi transfer map

1. In the method of mapping, first define a file, and then continue to write the information in

2. Through the activity callback, use the method, displayed on the server side.

Thinking:

(1) The whole process, URL routing using the design mode, specifically or need to find their own.

(2) In parsing the HTTP process, you need to understand some rules and the processing of strings, this needs to be familiar with the use of the string method.

(3) To understand the basic principles of HTTP communication, it is convenient for you to use the API process more accurate.

(4) You still need to go through the official documentation to find out how each API works and how it is used.

(5) You can also see that you need to know how the client sends the message (see the first line of code)

(6) This is a good breakthrough, let yourself to take the initiative to find some demo to deepen their cognition.

(7) for network mode, still need to add permissions on Androidmanifest

(8) Telnet in the use of the MacBook Terminal, is very convenient, is also very convenient through the mobile phone query to the IP

Mobile Server micro-architecture design and implementation topics

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.