I wrote a simple program that connects to thousands of mikrotik RouterOS devices one by one.
Code: Select all
for i:=0 to count(device) do
begin
sshClient.hostname := device(i); // ip address
sshClient.connect;
sshShell.connect;
sshShell.WriteString('ls'+#13#10);// or some other commands
sshShell.disconnect;
sshClient.disconnect;
end;
1. after 80 or 100 connections, my cpu usage hits %100.. and i had to close and reopen the program. then everything is fine until another 80-100 connection. csrss.exe and my program shares the cpu usage. i read that csrss.exe file is used to establish the communication by windows.
it is like the disconnect statements dont close the actual connection and i get many connections open at the same time. and after some, my cpu can handle all of them. therefore i hit the maximum cpu usage. what should i do? is there anything to do with memory? any suggestions please?
2. i get the following error sometimes.. "A call to an OS function failed". i have no idea which fuction is that. it is unpredictable. i get it sometimes, but sometimes don't.
Please help.. thanks a lot.