Cradle  0.3.3
Simple library for creating Web-based applications
Icmp Class Reference

ICMP protocol wrapper. More...

Static Public Member Functions

static ping ($host, $params=null)
 

Static Public Attributes

static $command = 'ping -q -n -c 1 -i 1 -W [TIMEOUT] [HOST]'
 

Detailed Description

ICMP protocol wrapper.

A simple class to send ICMP protocol requests to check is target host reachable.

This class just use Linux ping command.

Version
4.0
Author
Digger mrdig.nosp@m.ger@.nosp@m.sad-s.nosp@m.yste.nosp@m.ms.ru

Example of usage:

<?php
print_r( Icmp::ping('localhost') );
print_r( Icmp::ping('localhost', ['tryCount'=>4, 'timeout'=>2]) );

Member Function Documentation

static ping (   $host,
  $params = null 
)
static

ICMP ping command wrapper

Parameters
string$hostHostname (IP address)
array$paramsAn array of params: [
'fast' => true, // stop send the ping on first success result
'tryCount' => 3, // count of retries if no response
'timeout' => 1, // first timeout in seconds
'timeoutIncrease' => true // increase every next retry timeout on 1 second
]
Returns
int
0 - alive
1 - unreachable
2 - error

Field Documentation

$command = 'ping -q -n -c 1 -i 1 -W [TIMEOUT] [HOST]'
static

External ping command string


The documentation for this class was generated from the following file: