here is a very simple port scanner in php, save it in a php file, create a form passing values $host $lowport and $highport and you have yourself a nice little lightweight port scanner. I know you asked for one in c but I don't know c although it should be similiar. hope it helps.


$time = 1;
if ($pressed)
{
set_time_limit(0);
echo "Scanning $host" . "...
\n"; flush();
for ($i = $lowport; $i <= $highport; $i++) {
$portn = fsockopen($target, $i, $errno, $errstr, $time);
if (!$portn) {
echo "Port $i is not open on $host";
flush();
}
else {
echo "Open port at $i";
flush();
fclose($portn);
}
}
}