Question Proxy WebRequest

graham23s

Member
Joined
Feb 22, 2009
Messages
13
Programming Experience
1-3
Hi Guys,

I have maybe 3 POST requests in a piece of code, in each httpwebrequest i have:

PHP:
                            '// Has proxies been used?
                            If (formProxies.listViewProxies.Items.Count > 0) Then

                                '// Initialise the random user agent code
                                Dim randomProxy As New Random

                                '// Set a variable to store the random proxy
                                Dim randonProxySelected = formProxies.listViewProxies.Items.Item(randomProxy.Next(0, formProxies.listViewProxies.Items.Count))

                                '// If it's greater than 0 there are proxies loaded
                                Dim ProxyArray As Array = Split(randonProxySelected.Text, ":")

                                'MessageBox.Show(ProxyServer)
                                Dim ProxyServer As String = ProxyArray(0).ToString
                                Dim ProxyPort As Integer = ProxyArray(1).ToString

                                '// Setup the proxy
                                .Proxy = New WebProxy("http://" & ProxyServer & ":" & ProxyPort)

                            End If

Which selects a random proxy from a listview, some of them are hanging, should the same proxy be used on every httpwebrequest in the same piece of code? the way it is now, on every request 3 random proxies are chosen, i'm not sure if that's whats causing the hanging to happen.

thanks for any info guys

Graham
 
if you wanna send your data via post method , & each time with a different Proxy server , you need to connect to that proxy server first before posting.
i think you don't need to put HTTP:// before ip address , beside that which part does your app hang ? it can be possible your proxy server is down & it fails on connecting .
here is a piece of code that can help you out :
VB.NET:
   Dim client2 As New Net.Sockets.TcpClient
        client2.Connect("219.93.178.162", 3128)
        Dim writer As New IO.StreamWriter(client2.GetStream)
        writer.WriteLine("GET http://x.ir/ip.php HTTP/1.1")
have a nice coding
 
Back
Top