protected function check_port($port = 8000, $host = '127.0.0.1', $timeout = 3) { $fp = @fsockopen($host, $port, $errno, $errstr, $timeout); if (!$fp) { return true; } else { fclose($fp); return false; } }