Index: qscan.nse =================================================================== --- qscan.nse (revision 19518) +++ qscan.nse (working copy) @@ -388,7 +388,9 @@ -- account some of the RTT differences, but I think it really depends -- on how many ports were scanned and how many were forwarded where. -- Play it safer here. - pcap:set_timeout(2 * host.times.timeout * 1000) + local read_timeout = 2 * host.times.timeout * 1000 + -- add a couple of extra seconds to the timeout for the first read only. + pcap:set_timeout(read_timeout + 2000) local tcp = genericpkt(host) @@ -419,6 +421,11 @@ stats[j].sent = stats[j].sent + 1 local status, len, _, pkt, stop = pcap:pcap_receive() + + -- reset the timeout after the first read has been completed. + if i==1 and j==1 then + pcap:set_timeout(read_timeout) + end if not stop then -- probably a timeout, just grab current time