开发者

Http request in vb.net program freezing

I have just made a program were i enter a proxy list then my software views a url over and over using the proxys . I was using a web browser in side the program but worked out slow. So i now have changed the code to htpp request. 开发者_开发知识库But now when i run the program it goes up by 2 the views then frezzes . Here is my code

 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    If ListBox1.Items.Count = 1 Then
        Timer1.Enabled = False
        MsgBox("All Proxies Used")

    Else

        Dim url As String = TextBox1.Text

        UseProxy(ListBox1.Items(itemnumber))



        Dim inStream As StreamReader
        Dim webRequest As WebRequest
        Dim webresponse As WebResponse
        Dim url2 As New System.Uri(TextBox1.Text)
        webRequest = webRequest.Create(url2)
        webresponse = webRequest.GetResponse()
        inStream = New StreamReader(webresponse.GetResponseStream())

        Dim myRequest As WebRequest = webRequest.Create(url2)
        Dim myResponse As WebResponse = myRequest.GetResponse()
        myResponse.Close()


        Label1.Text = ListBox1.Items.Count
        WebBrowser1.ScriptErrorsSuppressed = True
        Label6.Text = Label6.Text + 1
        Label5.Text = ListBox1.Items.Count * 15 / 60 & " Minutes"
    End If


End Sub

Also i try just going to the website and not grabing anything which makes the program not frezze but the views does not go up

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    If ListBox1.Items.Count = 1 Then
        Timer1.Enabled = False
        MsgBox("All Proxies Used")

    Else

        Dim url As String = TextBox1.Text

        UseProxy(ListBox1.Items(itemnumber))



        Dim myRequest As WebRequest = WebRequest.Create(url)
        Dim myResponse As WebResponse = myRequest.GetResponse()
        myResponse.Close()


        Label1.Text = ListBox1.Items.Count
        WebBrowser1.ScriptErrorsSuppressed = True
        Label6.Text = Label6.Text + 1
        Label5.Text = ListBox1.Items.Count * 15 / 60 & " Minutes"
    End If


End Sub

So have tried both but both don't work


Try this: http://www.emoreau.com/Entries/Articles/2006/12/The-BackgroundWorker-component.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜