.net c# sending customer variable objects and handling them with a listener?


Still relatively new to .net and c# and I've been googling this but i'm convinced it's possible and that i'm probablyjust not using the right terminology / keywords to find what i'm looking for. i'll give you a full run down of what i'm doing.

my first class takes 2 ip addresses a start and a finish. i want to scan each ip address in the range and display it as online or offline (also want to do other stuff like resolve host names, os, mac address ect but that will come later) what i want is split the work up into multiple worker threads but i'm having problems with the process.

so what i want is for the main thread to start a second thread that will act as a listener it will then use a for loop to spin up a thread for each ip address that needs scanning (variable number of ip addresses from 1 to 255)

these threads will scan the ip address, resolve the host name and anything else i want. then this is the part i'm stuck on. I want to combine these variables into a single object that can be extracted by the listener thread then send it send it over and then terminate

so a object that contains (index, IP, Status, Hostname, Mac, OS,)

the listener thread will take these objects as they're passed to it and combine them into a large object (not sure that's the right name) and once all threads have returned with either an object for online devices or a message of offline it will then return to the main thread with the data in a object again to be displayed on screen ect.

what i'm not familiar with and i don't think i'm wording right on the google searches is the correct way to package this data up and end it over and then extract it on the other side.

if anyone has any links to knowledge articles, tutorials or examples of similar stuff that would be great. or even if you can let me know the correct terminology so that i might have better look searching this in the future.

Thanks for any help Mat

By : Delo1987


I think Parallel.ForEach is what you are looking for. It would allow you to perform requests in parallel, and then you can use some type of thread safe collection to merge the results.

By : vtortola

Try to change directory to the root of your new project, then run meteor.

$ cd my/directory/root
$ meteor
By : ndcomix

This video can help you solving your question :)
By: admin