[Analysis of Android]ping-c 1-w sina.cn

Source: Internet
Author: User

Source: http://my.oschina.net/u/996206/blog/189914

Android Environment:
Ping-c 1-w sina.cn

-C: Indicates the number of times, 1 is 1
-W: Represents deadline, time out, in seconds, 100 for 100 seconds.

The connection means that the ping host sina.cn once and the timeout is 100 seconds.
Fatal problem: If this action is placed on the Android UI thread to do, there may be a problem.
The general scenario is to perform the "Ping-c 1-w sina.cn" in the UI thread from a runtime process, and then wait for it to return, typically process.waitfor ().
To know that Ping does not return for a long time, the worst case here is waiting for 100 seconds, and we know that the Android UI thread will have a problem with the ANR for a long time block.
So this scenario is a software design problem.

[Analysis of Android]ping-c 1-w sina.cn

Related Article

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.