That's Cool
-
In my media at home project, I discovered the need to scan the local network for connected machines. My idea was to start with the local machine's IP in order to establish the applicable subnet, and then cycle through each IP address in that subnet, and see if a device is assigned to that IP. If the IP isn't found, it takes about 10 seconds to timeout (and throw an exception). Without multi-threading, it takes over 38 minutes to scan (from x.x.x.1 to x.x.x.255), and because it's performed on the UI thread, the app remains completely unresponsive while it's running. WITH multi-threading - it takes 1 minute, and the main window remains completely responsive. When I target just the ranges of IP's I know are in use (+/- 5 IPs on either side of each range), the threaded version takes just 12 seconds.
".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 -
In my media at home project, I discovered the need to scan the local network for connected machines. My idea was to start with the local machine's IP in order to establish the applicable subnet, and then cycle through each IP address in that subnet, and see if a device is assigned to that IP. If the IP isn't found, it takes about 10 seconds to timeout (and throw an exception). Without multi-threading, it takes over 38 minutes to scan (from x.x.x.1 to x.x.x.255), and because it's performed on the UI thread, the app remains completely unresponsive while it's running. WITH multi-threading - it takes 1 minute, and the main window remains completely responsive. When I target just the ranges of IP's I know are in use (+/- 5 IPs on either side of each range), the threaded version takes just 12 seconds.
".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, 1997Cool - but there is a simpler way: Retrieving IP and MAC addresses for a LAN[^]
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
-
In my media at home project, I discovered the need to scan the local network for connected machines. My idea was to start with the local machine's IP in order to establish the applicable subnet, and then cycle through each IP address in that subnet, and see if a device is assigned to that IP. If the IP isn't found, it takes about 10 seconds to timeout (and throw an exception). Without multi-threading, it takes over 38 minutes to scan (from x.x.x.1 to x.x.x.255), and because it's performed on the UI thread, the app remains completely unresponsive while it's running. WITH multi-threading - it takes 1 minute, and the main window remains completely responsive. When I target just the ranges of IP's I know are in use (+/- 5 IPs on either side of each range), the threaded version takes just 12 seconds.
".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 -
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 -
Cool - but there is a simpler way: Retrieving IP and MAC addresses for a LAN[^]
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
Nice! :thumbsup: /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
Cool - but there is a simpler way: Retrieving IP and MAC addresses for a LAN[^]
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
I found another way here: http://stackoverflow.com/questions/997046/gethostentry-is-very-slow[^] It took the non-threaded version down to two minutes, and the threaded one down to 1 second. (Checking all IPs from 1 to 255).
".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 -
Can't the timeout be made shorter? 10 seconds is a truly ridiculous length of time on a LAN.
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 -
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 -
I found another way here: http://stackoverflow.com/questions/997046/gethostentry-is-very-slow[^] It took the non-threaded version down to two minutes, and the threaded one down to 1 second. (Checking all IPs from 1 to 255).
".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, 1997Interesting! I'll have a look at it tomorrow - i'm on a 2"x2" screen and it's a PITA to view code.
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
-
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 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 -
In my media at home project, I discovered the need to scan the local network for connected machines. My idea was to start with the local machine's IP in order to establish the applicable subnet, and then cycle through each IP address in that subnet, and see if a device is assigned to that IP. If the IP isn't found, it takes about 10 seconds to timeout (and throw an exception). Without multi-threading, it takes over 38 minutes to scan (from x.x.x.1 to x.x.x.255), and because it's performed on the UI thread, the app remains completely unresponsive while it's running. WITH multi-threading - it takes 1 minute, and the main window remains completely responsive. When I target just the ranges of IP's I know are in use (+/- 5 IPs on either side of each range), the threaded version takes just 12 seconds.
".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, 1997and when are you releasing this cool stuff? been waiting an update on this project :-)
Life - Dreams = Job TheCardinal
-
In my media at home project, I discovered the need to scan the local network for connected machines. My idea was to start with the local machine's IP in order to establish the applicable subnet, and then cycle through each IP address in that subnet, and see if a device is assigned to that IP. If the IP isn't found, it takes about 10 seconds to timeout (and throw an exception). Without multi-threading, it takes over 38 minutes to scan (from x.x.x.1 to x.x.x.255), and because it's performed on the UI thread, the app remains completely unresponsive while it's running. WITH multi-threading - it takes 1 minute, and the main window remains completely responsive. When I target just the ranges of IP's I know are in use (+/- 5 IPs on either side of each range), the threaded version takes just 12 seconds.
".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, 1997Hmmm... 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.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
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 -
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.
A guide to posting questions on CodeProject[^]
Dave KreskowiakIt'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 -
I found another way here: http://stackoverflow.com/questions/997046/gethostentry-is-very-slow[^] It took the non-threaded version down to two minutes, and the threaded one down to 1 second. (Checking all IPs from 1 to 255).
".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 -
In my media at home project, I discovered the need to scan the local network for connected machines. My idea was to start with the local machine's IP in order to establish the applicable subnet, and then cycle through each IP address in that subnet, and see if a device is assigned to that IP. If the IP isn't found, it takes about 10 seconds to timeout (and throw an exception). Without multi-threading, it takes over 38 minutes to scan (from x.x.x.1 to x.x.x.255), and because it's performed on the UI thread, the app remains completely unresponsive while it's running. WITH multi-threading - it takes 1 minute, and the main window remains completely responsive. When I target just the ranges of IP's I know are in use (+/- 5 IPs on either side of each range), the threaded version takes just 12 seconds.
".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, 1997You 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?
-
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 -
Cool - but there is a simpler way: Retrieving IP and MAC addresses for a LAN[^]
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
-
Well I'm not typing it out again! :laugh:
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.