Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


vb.net send multiple connections at the same time


vb.net send multiple connections at the same time

Author
Message
Shinzor
Shinzor
Forum God
Forum God (409 reputation)Forum God (409 reputation)Forum God (409 reputation)Forum God (409 reputation)Forum God (409 reputation)Forum God (409 reputation)Forum God (409 reputation)Forum God (409 reputation)Forum God (409 reputation)

Group: Forum Members
Posts: 1, Visits: 6
Hi friends,



I need a little help with using multi-threading in my mini project the idea of the project is to send GET REQUEST To download multiple pages at the same time,

so for that we need to send multiple connections at the same time.



My current code is using only one thread to send the requests it send one request and then wait until the request is finished, then it send the next one..



Here's my base code:



Public Class Form1



Dim thread1 As System.Threading.Thread



Private sub sendReq()

'Header Options

Request.Method = "GET"



Request.UserAgent = "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0"

Request.AllowAutoRedirect = True

Request.MaximumAutomaticRedirections = 9

Request.Headers.Add("pragma", "no-cache")

Request.Headers.Add("Accept-Encoding", "gzip,deflate,sdch")

Request.Headers.Add("cache-control", "no-cache")

Request.AllowWriteStreamBuffering = True

'Creating the responsder and Stream Reader

Dim Response As HttpWebResponse = Request.GetResponse

Dim ResponseStream As System.IO.Stream = Response.GetResponseStream



'Creating Another Stream Reader

Dim StreamReader As New System.IO.StreamReader(ResponseStream)

Dim Data As String = StreamReader.ReadToEnd



StreamReader.Close()

Response.Close()



...etc

End Sub





thread1 = New Thread(AddressOf Me.sendReq)

thread1.Start()



Please tell me that changes should i do, to send multiple connections



GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search