Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Multi-Thread HttpRequests?

    This is actually VB.NET program I'm running on my server to deal with data collected through an ASP.net web page. I'm just starting working on a program and the amount of pages I'm trying to screen scrape take over 20 minutes, so I was hoping I could run like 4 or 5 threads to cut that down??? I'm pretty much still a novice, so be easy on me. I understand good, though.

  • #2
    Regular Coder
    Join Date
    May 2007
    Location
    UK
    Posts
    180
    Thanks
    0
    Thanked 18 Times in 18 Posts
    Here is a brief example with 2 threads:
    Code:
    Imports System.Threading
     
    Module Module1
      Sub Main()
        'Create 2 threads and tell them what to do...
        Dim t1 As New Thread(AddressOf Process1)
        Dim t2 As New Thread(AddressOf Process2)
     
        'Start the threads...
        t1.Start()
        t2.Start()
     
        'Wait for the threads to finish...
        t1.Join()
        t2.Join()
     
        'Both threads have now finished.
      End Sub
     
      Sub Process1()
        'Do something here...
      End Sub
     
      Sub Process2()
        'Do something else here...
      End Sub
    End Module
    
    Last edited by SouthwaterDave; 12-03-2009 at 09:20 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •