How to write a high-efficiency ping test using PHP

Source: Internet
Author: User
Hundreds of IP, is to be able to find a timely IP is not through.
The message is then returned.
Side dishes, just on the internet to read a few code, useful ping, useful socket,curl, to write
But do you think the efficiency is not quite appropriate?
Ask an experienced friend to support a weapon.

Reply content:

Hundreds of IP, is to be able to find a timely IP is not through.
The message is then returned.
Side dishes, just on the internet to read a few code, useful ping, useful socket,curl, to write
But do you think the efficiency is not quite appropriate?
Ask an experienced friend to support a weapon.

Use PHP to call the Linux Fping tool through the system function, so you can ping it in batches. (Fping can make a large number of ping requests in parallel in a rotating fashion)
So simple code, you should write it?

Use the tools, don't build your own wheels.

You should try the asynchronous library, which will take the longest delay in the ping and not all of the ping time accumulation. PHP has Swoole, which is located in Https://github.com/swoole/swoole-src. You can also choose Nodejs to pass the final results to PHP via the API.

  • 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.