|
This is great information. I don't need it right now, but I have bookmarked it.
Soren Madsen
|
|
|
|
|
tss... shameless self-promotion
(but bookmarked and fived anyway)
|
|
|
|
|
Well I'm not typing it out again!
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
Can't the timeout be made shorter? 10 seconds is a truly ridiculous length of time on a LAN.
|
|
|
|
|
I dunno. Haven't looked yet.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Check this out:
http://stackoverflow.com/questions/997046/gethostentry-is-very-slow[^]
The threaded version of my code went from 1 minute to 1 second, and the un-threaded went from 38 minutes to just two minutes.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Nice, which solution did you use?
|
|
|
|
|
I used the one I cited (no offense to Grif, of course).
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
I could be missing something here, but the link went to the question, not to an answer
|
|
|
|
|
Oops - look at the last answer.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
and when are you releasing this cool stuff? been waiting an update on this project
Life - Dreams = Job
TheCardinal
|
|
|
|
|
Hmmm... I just completed a data gathering service that goes out to all the servers in my SCCM infrastructure and gathers a bunch of data on each. It's all Task based and takes 2 to 3 seconds to get the server inventory from SCCM then scan the (currently) 26 servers I have.
I know it's not scanning a range of IP's, but 12 seconds seems long to have 1 Task per IP to hit 253 IP's.
|
|
|
|
|
It's also enumerating shared disks when it finds an active IP.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
You have 256 tasks, which at least originally took several seconds, but reliably end, no matter if successful or not. They can be carried out independently without any data synchronization, you just have to go through the results afterwards.
That screams for parallel processing. The conditions could not be better. I can't believe that this is a real surprise to an old trapper like you. Just out of curiosity: Did you really use 256 instances of a custom thread class or simply use the Parallel class, something like a Parallel.For() loop?
|
|
|
|
|
It's not a surprise, and I'm using the Task thingamajig...
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
I did it this way:
public static void GetLanMachinesThreaded(System.Windows.Threading.Dispatcher dispatcher,
List<HostAddress> subnet,
Control control,
bool setItemsSource=false)
{
List<Task> tasks = new List<Task>();
foreach(HostAddress item in subnet)
{
var t = Task.Factory.StartNew(() => { item.FindHost(); });
tasks.Add(t);
}
Task.Factory.ContinueWhenAll(tasks.ToArray(), result =>
{
subnet.RemoveAll(item => item.Host == null || item.Shares.Count == 0);
if (control != null)
{
if (control is ItemsControl && setItemsSource)
{
dispatcher.BeginInvoke(new Action(() => ((ItemsControl)control).ItemsSource = subnet));
}
dispatcher.BeginInvoke(new Action(() => control.Focus()));
}
});
}
The item.FindHost method searches for the IP's specified in the subnet parameter, and then looks for disk shares on hosts that were found. once that's completed, it removes shares that are specified in a filter list (default shares, and anything that isn't a disk share), and then removes any hosts that end up with no shares found. If the disks are spun up from recent access, it now takes about 25 seconds (because of the disk share enumeration). If the disks aren't spun up, it takes almost twice as long. Since this only happens when the user specifically wants to add a new shared media source, I think the performance is acceptable, and I'm not sure it could be made much (if any) faster.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|