| 1 | <?php |
||
| 13 | class Network { |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Check if a port is open |
||
| 17 | * @param string $host |
||
| 18 | * @param integer $port |
||
| 19 | * @return boolean |
||
| 20 | */ |
||
| 21 | public static function is_port_open($host, $port) |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Find an open port in a given range, trying several times. |
||
| 34 | * Return FALSE if no open port is found after a timeout (1 second by default) |
||
| 35 | * |
||
| 36 | * @param string $host |
||
| 37 | * @param integer $range_start |
||
| 38 | * @param integer $range_end |
||
| 39 | * @param integer $timeout |
||
| 40 | * @return integer|boolean |
||
| 41 | */ |
||
| 42 | public static function ephimeral_port($host, $range_start = 1000, $range_end = 5000, $timeout = 1000) |
||
| 49 | } |
||
| 50 |