Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

VB.NET Proxy Question....

VB.NET Proxy Question....

VB.NET Proxy Question....

I am interested in learning more about proxy connections. I've been doing a little testing with connecting to proxies through the HttpWebRequest & using the request.Proxy & request.Timeout. But I've noticed that it seems to be a little difficult trying to move on to the next proxy after checking for 5 seconds. The program will NOT continue on without finishing the connection to the current proxy being checked on the list which FAR exceeds the 5 second limit that I'm trying to create.

Say I want the proxy to try connecting for only 5 seconds, then moving on to the next. If that proxy didn't connect within 5 seconds, it should then be added to the "Failed" proxy list, then the next proxy in line should be checked & so on. How would I accomplish this?

Here is the code that I've come up with thus far:


Dim ProxyLine As Integer = 0

Sub ProxyChecker()
        Dim i As Integer = 0
        Do Until i = ListBox1.Items.Count
            Dim myproxy As WebProxy
            Dim proxynumber As String = ListBox1.Items(ProxyLine)
                'Show progress in form:
                Me.Text = "Yell Proxy Checker - Checking Proxy # " & ListBox1.Items(ProxyLine) & "  -  " & ProxyLine + 1 & "/" & ListBox1.Items.Count
                'Show selected proxy being tested in listbox1:
                ListBox1.SelectedItem = ListBox1.Items(ProxyLine)

                myproxy = New WebProxy(proxynumber)
                Dim request As HttpWebRequest = HttpWebRequest.Create("https://www.MyCrappyWebsite.com/")
                request.UserAgent = "Mozilla/5.0 (Windows NT x.y; rv:10.0) Gecko/20100101 Firefox/10.0"
                request.Timeout = 5000
                request.Proxy = myproxy
                Dim response As HttpWebResponse = request.GetResponse

                TextBox2.Text += proxynumber & vbCrLf

            Catch ex As Exception
                'FAILED CONNECTION:
                TextBox3.Text += proxynumber & vbCrLf
            End Try
            'Increment ProxyLine:
            ProxyLine += 1


Again, I'm trying to connect for only 5 seconds & if that proxy doesn't connect within that time period, then send it to the "FAILED" list, & continue on to the next proxy in line.

Would appreciate the support!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close