Hello guys. I have a little problem.
I have this class:
This will ask for one proxy each time my webclient does something five times.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
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.


Reply With Quote