You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was able to get 300-500 threads going (depends on the system - specify 500, .net may only open 300)
I believe ports were not being cleaned up perhaps.
Much less cpu - and a quicker finish.
for (int i = 0; i < threadCounter; i++)
{
if (!portList.MorePorts())
return;
In RunScanTcp
Thread.Seep(100)` //quicker, more threads, than 1ms
var con = Connect(host, port, tcpTimeout);
if (con != null)
{
con.Close();
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("TCP Port {0} is open ", port);
}
In Connect
Instead of throw Exception
newClient.Close();
return null;
PortList
private Object threadLock = new Object();
public bool MorePorts()
{
lock (threadLock) return (stop - ports) >= 0;
}
public int NextPort()
{
lock (threadLock)
{
if (MorePorts())
{
return ports++;
}
}
return -1;
}
Hi mate.
I was able to get 300-500 threads going (depends on the system - specify 500, .net may only open 300)
I believe ports were not being cleaned up perhaps.
Much less cpu - and a quicker finish.
In PortScanner.start
In RunScanTcp
In Connect
Instead of throw Exception
PortList