IOS Network Errors-Categories

Source: Internet
Author: User

All kinds of errors are encountered during the network data exchange.

These network errors are from the client or the server.

Let's comb it out:

We divide the error into three major categories

    1. Operating system error
    2. HTTP request Error
    3. Application Error
1. The operating system error is due to the failure of the packet to reach the intended target, which may be caused by:
    1. No network-no network connection
    2. Could not be routed to the target host--mainly because the target host may be in an isolated network or offline state.
    3. No listener target port is applied-the packet is sent to the specified port number after the request reaches the target host, and if the server does not listen for the port number or if there are too many requests queued then the connection request is rejected.
    4. Unable to resolve target host name--url loading system will return an error. These errors are usually caused by configuration errors or attempts to access hosts that do not have external name resolution and are in an isolated network.
In iOS's URL-loading system, an operating system error is sent to the app as a Nserror object. iOS passes error messages through Nserror in the software. The main advantage of using Nserror is that the Nserror object contains the error domain property; There are many network request problems because the network is not connected, so we need to check every time we make a network request, because the mobile device will move out of the network. Here we usually use reachability;
HTTP Error: HTTP error is caused by an HTTP request, an HTTP server or an application server problem. HTTP errors are sent to the requesting client through the status code of the HTTP response. Class 5 HTTP Error
    • Informational 100-level-information from the HTTP server, the processing of the request will continue, but with a warning.
    • Successful Level 200-services please accept the request.
    • REDIRECT requires a level 300--the resource has moved and needs to be redirected.
    • Client Error Level 400--Indicates that the client issued data that the server was unable to properly handle the error, such as an incorrect HTTP header that caused this range error.
    • Downstream error level 500-Indicates an error occurred between the HTTP server and the downstream application server.
Application errors These errors are caused by the business logic and applications running on top of the service layer. Errors can be code problems, such as exceptions, or semantic problems, such as providing an invalid account to the service. Another example is that there are 500 yuan in the bank card and you have to raise 1000 yuan in cash, which will make a mistake.

Advanced programming from the iOS network.

IOS Network Errors-Categories

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.