Question about multiple threads
-
I have the following situtation In my program i want to do request an dns lookup for several servers. How many servers are variable and are listed in a string array. Now i want to request the dns lookup not after each other but i want to do them in threads. So that not one dns lookup is waiting before the other is ready. From each dns lookup thread i want the IPaddress as return value. And after all i want my program to continue after all threads are stopt. So a quick summary - Program start - List of servers is in array list (for example 10) - Starts 10 threads with the server to check as parameter - Get response of the threads (and keep them in memory) - Continue with program after all threads are done I hope someone can help me with this. I search a lot about Threads but havend found a clear solutions for this problem. And if you think you had an other/better solution without threads, please reply also. Thanx
-
I have the following situtation In my program i want to do request an dns lookup for several servers. How many servers are variable and are listed in a string array. Now i want to request the dns lookup not after each other but i want to do them in threads. So that not one dns lookup is waiting before the other is ready. From each dns lookup thread i want the IPaddress as return value. And after all i want my program to continue after all threads are stopt. So a quick summary - Program start - List of servers is in array list (for example 10) - Starts 10 threads with the server to check as parameter - Get response of the threads (and keep them in memory) - Continue with program after all threads are done I hope someone can help me with this. I search a lot about Threads but havend found a clear solutions for this problem. And if you think you had an other/better solution without threads, please reply also. Thanx
If your using threads I highly recommend using the ThreadPool class. Caution, there is an error with the ThreadPool with WebRequests, but I am not sure if it applies to Dns class.
R.Bischoff | C++ .NET, Kommst du mit?