"; $line = 0; if (!($fd=fsockopen("sock/$port", 0))) echo "cannot connect to sock $port"; else { register_shutdown_function(killme); $needline = true; $buf = ""; # For some reason on my RH9 this script does not terminate on user abort while (!connection_aborted()) { ignore_user_abort(FALSE); if ($buf=="") { # FIX for PHP4.2.2: fread not returns if blocking socket_set_blocking($fd,0); $buf = fread($fd,8192); } if ($buf=="") { if (feof($fd)) break; ob_end_flush(); flush(); socket_set_blocking($fd,1); $buf = fread($fd,1); } if ($needline!==false) { $needline = false; $l = 1-$l; echo "
"; echo str_replace(" ", " ", sprintf("%6d: ", ++$line)); } if (($needline=$o=strpos($buf, "\n"))===false) $o = strlen($buf); $s = htmlentities(substr($buf,0,$o)); $buf = substr($buf,$o+1); if (substr($s,0,1)==" ") $s = " ".substr($s,1); echo str_replace(" ", "  ", $s); if ($needline!==false) echo "
\n"; } fclose($fd); echo "
"; } ?>
- LOG END -