Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5963509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:15:57+00:00 2026-05-22T19:15:57+00:00

I am trying to make a application which will check it can ping outside

  • 0

I am trying to make a application which will check it can ping outside but it never stop. How can i apply a command to terminal and stop the action? Example in following case:

$ php -r "echo system('ping 127.0.0.1');"
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_req=1 ttl=64 time=0.073 ms
64 bytes from 127.0.0.1: icmp_req=2 ttl=64 time=0.073 ms
64 bytes from 127.0.0.1: icmp_req=3 ttl=64 time=0.072 ms
64 bytes from 127.0.0.1: icmp_req=4 ttl=64 time=0.074 ms
64 bytes from 127.0.0.1: icmp_req=5 ttl=64 time=0.071 ms
64 bytes from 127.0.0.1: icmp_req=6 ttl=64 time=0.073 ms
64 bytes from 127.0.0.1: icmp_req=7 ttl=64 time=0.074 ms
64 bytes from 127.0.0.1: icmp_req=8 ttl=64 time=0.073 ms
64 bytes from 127.0.0.1: icmp_req=9 ttl=64 time=0.074 ms
64 bytes from 127.0.0.1: icmp_req=10 ttl=64 time=0.081 ms
64 bytes from 127.0.0.1: icmp_req=11 ttl=64 time=0.072 ms
64 bytes from 127.0.0.1: icmp_req=12 ttl=64 time=0.075 ms

Note: ctrl+c was applied to stop but this will be executed via web browser.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:15:58+00:00Added an answer on May 22, 2026 at 7:15 pm

    This can be done with proc_open. For instance, this program will only let ping6 run for around 5 seconds:

    <?php
    $descriptorspec = array(
       1 => array("pipe", "w"),
    );
    
    $process = proc_open('ping6 ::1', $descriptorspec, $pipes);
    
    $emptyarr = array();
    $start = microtime(true);
    if (is_resource($process)) {
        stream_set_blocking($pipes[1], 0);
        while (microtime(true) - $start < 5) {
            $pipesdup = $pipes;
            if (stream_select($pipesdup, $emptyarr, $emptyarr, 0, 100000))
                echo fread($pipes[1], 100);
        }
    
        fclose($pipes[1]);
        proc_terminate($process);
    }
    

    In your case, you might want to check connection_aborted(). But notice you have to keep sending (and flushing) data for the user abort to be detected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make an application using AppleScript which can remind to check
I am trying to make a simple application which will be used to point
I'm trying to make a vector drawing application using OpenGL which will allow the
Recently I was trying to make a calendar application that will display the current
I am trying to make a web directory submission tool which will submit to
I'm trying to fashion a solution which will simulate App_Offline.htm for remote access but
I'm trying to make my first application using Objective C + Core Data, but
I am trying to make a peer 2 peer audio/video application, but behind NAT
I'm trying to make an application that can host multiple ecommerce front ends, so
I am trying to make a application in java which connects to a mysql

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.