Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Question about multiple threads

Question about multiple threads

Scheduled Pinned Locked Moved C#
helpsysadmindata-structuresperformancetutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Johan de Koning
    wrote on last edited by
    #1

    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

    T 1 Reply Last reply
    0
    • J Johan de Koning

      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

      T Offline
      T Offline
      TigerNinja_
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups