ANDROID_ Network Fundamentals

Source: Internet
Author: User

What is the HTTP protocol?

HTTP protocol is the Hypertext Transfer Protocol, is the basis of Web networking, is also one of the common mobile phone networking protocols, the HTTP protocol time in the TCP protocol of the application of IQ. The notable feature of HTTP connections is that each request sent by the client requires the server, and the connection is actively released after the request is over. The process from establishing a connection to closing a connection is called a "one connection"

What is the HTTPS protocol?

HTTPS, which is a security-targeted HTTP channel, is the secure version of HTTP, the default port for HTTPS, unlike HTTP, and the presence of an encryption and authentication layer (between HTTP and TCP), which is widely used for security-sensitive communications on the World Wide Web, such as transaction payments.

Get Network permissions in Android

<android:name= "Android.permission.INTERNET"/>    <!--  allow programs to open network sockets -     <android:name= " Android.permission.ACCESS_NETWORK_STATE "/>    <!-- allow programs to access network connection information  -

Detect Network Connections in Android

1.ConnectivityManager: He will answer the query results about the network connection, and the change in the network is to notify the application.

2.NetworkInfo: Describes a network interface state for a given type (mobile network or WIFI, etc.)

IP address and port number

1.IP Address: IP address is used to uniquely identify a machine in the network, is a 32 integer, usually expressed in 0~255 decimal number

2. Port number: Used to uniquely identify the network communication on the machine program, the same machine can not use two programs occupy the same port case; Port Number 11 16 is an integer, total 3 classes

---Recognized ports: typically some protocol ports (TCP/IP protocol) to tightly bind some special server scopes 0~1023

---Register port: Loosely bind some specific services, application maximum port number, range: 1020~49151

---dynamic/private ports: Typically applications are temporarily dynamically occupied, equivalent to a competing resource, and the application itself does not bind these ports

In general, its seat resource utilization range: 49151~65535

3. The real participation in the network communication is the computer disabled network communication program, the IP address is the equivalent of its street number, then the port indicates the room in which it lives, namely room number

Blocking and non-blocking

IO blocking and non-blocking mainly manifested in the IO operation process, such as in the process of reading data, the process of reading data is slow to prepare data, if waiting for data preparation, waiting, this is blocking, if the data is prepared to do something else, this is non-blocking,

Actual:

Xiao Ming is looking for Xiao Wang to borrow a book. But Xiao Wang forgot where to put the book, need to find a book, if at this time, Xiaoming has been waiting for Xiao Wang to find a book and lend him, this is blocking; if Xiao Ming in the process of Wang find books to play games, and later to find Xiao Wang, and Xiao Wang also found the book, Kengming borrowed books, this is non-blocking.

Synchronous vs. asynchronous (IO)

Determine the standard of synchronous and asynchronous: An IO operation until completion, whether to cause the program to block, if the blocking is synchronous, if not blocking is asynchronous;

The IO operation here refers to the real IO operation, which is the process of copying data from the kernel to the system process (that is, the process of reading).

Synchronization can improve the reliability of the program, and asynchronous can prompt the performance of the program, but does not guarantee the reliable operation of the program

ANDROID_ Network Fundamentals

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.