Multithreading with webClient & HttpWebRequest

russellhope

Registered Member
Joined
Jan 11, 2010
Messages
81
Reaction score
6
Hey,

This has been a bit of a pain trying to work this out.

Basically I have a bot that will sign up to a site, does what it needs to do and then repeats.

Instead of having to have 20 bots open on my computer I want to multi thread it.

Now I've tried likes of this, passing a random number to my site, echo'ing it on the site and returning it to a listbox, but it doesn't go any faster with 100 threads than 1 thread?

Code:
For i = 0 To 10            Dim thread = New System.Threading.Thread(AddressOf httpfetch)
            thread.IsBackground = True
            thread.Start()
        Next

Code:
Public Sub httpfetch()



        Dim rndnumber As Random
        Dim number As Integer
        rndnumber = New Random
        number = rndnumber.Next(1, 4)


        Dim webClient As New System.Net.WebClient
        Dim result As String = webClient.DownloadString("http://website.com/fetcher.php?i=" & number)


        ListBox1.Items.Add(result)


        TextBox2.Text = TextBox2.Text + 1


        httpfetch()


    End Sub

any help please?

Thanks
 
Research information about delegates and marshaling on vb.net
 
Back
Top