Results 1 to 2 of 2

Thread: Read one proxy from textfile every 5 times

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    83

    Read one proxy from textfile every 5 times

    Hello guys. I have a little problem.

    I have this class:

    Code:
    Public Class ProxyHelper
        Private Shared proxyQueue As New Queue(Of System.Net.WebProxy)()
        ' Just holds the number of times we've asked for a proxy.
        Private Shared proxyUses As Integer
    
        Public Shared Sub AddProxy(ByVal proxy As System.Net.WebProxy)
            proxyQueue.Enqueue(proxy)
        End Sub
    
        Public Shared Sub AddProxy(ByVal proxy As String)
            proxyQueue.Enqueue(New System.Net.WebProxy(proxy))
        End Sub
    
        Public Shared ReadOnly Property Count() As Integer
            Get
                Return proxyQueue.Count
            End Get
        End Property
    
        Public Shared Function GetProxy() As System.Net.WebProxy
            proxyUses += 1
            If proxyUses Mod 5 = 0 Then
                proxyQueue.Dequeue()
            End If
            Return proxyQueue.Peek()
        End Function
    End Class
    This will ask for one proxy each time my webclient does something five times.

    My webclient simply downloads some data and views it from a webpage over and over, and after 5 times you will get banned.

    Question: How can I make the above code ask for a proxy from a textfile with one proxy on each line?

    I will not have a browse function, the proxies.txt will always be in the app.dir


    Thanks
    All help is appreciated thanks.
    Last edited by retskrad; Mar 17th, 2009 at 06:11 AM.

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    83

    Re: Read one proxy from textfile every 5 times

    Please? I really need help with this.. if this is not enough info just tell me and i'll explain more in depth

Posting Permissions

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



Click Here to Expand Forum to Full Width