Skip to content

Commit

Permalink
Scan Port : check the return of the fwrite #59
Browse files Browse the repository at this point in the history
  • Loading branch information
shevabam committed Apr 3, 2018
1 parent 1d3a790 commit 050b1b6
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions libs/Utils/Misc.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,20 +189,27 @@ public static function scanPort($host, $port, $protocol = 'tcp', $timeout = 3)

$write = fwrite($handle, 'x00');

$startTime = time();
if ($write === false)
{
return false;
}
else
{
$startTime = time();

$header = fread($handle, 1);
$header = fread($handle, 1);

$endTime = time();
$endTime = time();

$timeDiff = $endTime - $startTime;

fclose($handle);
$timeDiff = $endTime - $startTime;
fclose($handle);

if ($timeDiff >= $timeout)
return true;
else
return false;
if ($timeDiff >= $timeout)
return true;
else
return false;
}
}

return false;
Expand Down

0 comments on commit 050b1b6

Please sign in to comment.