I wrote an application that downloads files via FTP every 10 seconds and I have the following timer's code.
timer3.Tick += new EventHandler(updateLogs);
timer3.Interval = (1000) * (10);
timer3.Enabled = true;
timer3.Start();
My updateLogs function:
timer3.Enabled = false;
server1_log = downloadLog("192.168.0.217", 1);
server2_log = downloadLog("192.168.0.216", 2);
server3_log = downloadLog("192.168.0.215", 3);
timer3.Enabled = true;
I realize that the requests may take longer than 10s and this is why I am disabling the timer before, and enabling after, calling downloadLog().
Still, after about a minute, the application freezes and the CPU usage jumps to 45+ %. When I comment out the timer3's code, the application runs fine for a long time and never crashes.
Any ideas?