Multi-socket - WeOnlyDo Discussion board

Multi-socket (wodWebServer / wodWebServer.NET)

by Celtik, Tuesday, July 15, 2008, 23:58 (5766 days ago)

OK, I am trying to multi-socket , and I am having some problems. With the code I am currently using, it only visits the website the same amount of times as the socket is loaded. For example when I use this code:

[code]For X = 0 To 25[/code]

it will only visit the site 25 times

What I am trying to do is make it keep loading/unloading , or whatever it is supposed to do and keep doing the events until it reaches txtViews.text I can't do for 1=txtViews.text because that will cause an overflow error easily.

Here is my full code:

Command:

[code]On Error Resume Next
Dim strsplit() As String
Dim usernames(999) As String
Dim passwords(999) As String
Dim X As Integer


For X = 0 To 25
Load HTTP(X)
HTTP(X).Disconnect
HTTP(X).Request.UserAgent = Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2
HTTP(X).Request.Accept = text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
HTTP(X).Get txtURL.Text
Pause txtPause.Text
Next X

If List1.ListCount <> 0 Then
For i = 0 To List1.ListCount - 1
List1.ListIndex = i

lblProxy.Caption = blah

strsplit() = Split(List1.List(i), : )
usernames(i) = strsplit(0)
passwords(i) = strsplit(1)

For X = 1 To txtSockets.Text
HTTP(X).Request.UserAgent = Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2
HTTP(X).Request.Accept = text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
HTTP(X).ProxyHostname = strsplit(0)
HTTP(X).ProxyPort = strsplit(1)
HTTP(X).Timeout = txtTimeout.Text
HTTP(X).Get txtURL.Text
Pause txtPause.Text
Next X
Next i
End If
End If
[/code]
Here is the data arrival:

[code]Private Sub HTTP_Done(index As Integer, ByVal ErrorCode As Long, ByVal ErrorText As String)
Dim sresults(100)

Dim oldcookie(100) As HttpCookie
For Each oldcookie(index) In HTTP(index).Response.Cookies
HTTP(index).Request.Cookies.Add oldcookie(index).Name, oldcookie(index).Value
Next

If ErrorCode <> 0 Then
HTTP(index).Abort
HTTP(index).Disconnect
ElseIf ErrorCode = 0 Then
sresults(index) = HTTP(index).Response.Body
lblViews.Caption = lblViews.Caption + 1
HTTP(index).Disconnect
End If
End Sub
[/code]
I am using WodHTTP which is a winsock wrapper, but that should not affect anything..Please help me in anyway you can, I know the code can be tweaked way better than this.

Re: Multi-socket

by woddrazen, Wednesday, July 16, 2008, 00:31 (5766 days ago) @ Celtik

Hi Celtik,


I'm sorry but I don't think this code in general will work. You have Next i after Next X and it should be opposite. Also EndIF is outside of loop and it should be inside.

Can you maybe make us some sample that will do what you want just one time without loop? So we can see what you want to achieve.

Please also remove pause from your code, you don't need it. It's only important that wodHttpDLX Blocking Property is set to True and commands will be execute line by line. This is most probably what you want to do.

Hope I helped.


Regards,
Drazen

Re: Multi-socket

by celtik, Wednesday, July 16, 2008, 01:01 (5766 days ago) @ woddrazen

What I want it to do is visit a site a certain amount of times. The sockets should not equal the views which is how it is doing now. Here is an example:
[image]

My program should be similar to this. I do not have txtViews anywhere in the code because I do not know what to do with it yet. Right now, it just visits the site 25 times because of the for i=1 to 25. The two fors is supposed to work like..if proxies are loaded it does something or if proxies arent loaded it does something..

Re: Multi-socket

by woddrazen, Wednesday, July 16, 2008, 10:24 (5765 days ago) @ celtik

Celtik,


When I try to open your URL i receive error:

You don't have permission to access /images/tubeincreasersample.jpg on this server.

Did you try perhaps using our samples?


Drazen

Re: Multi-socket

by celtik, Wednesday, July 16, 2008, 11:07 (5765 days ago) @ woddrazen

[image]

Re: Multi-socket

by woddrazen, Wednesday, July 16, 2008, 12:18 (5765 days ago) @ celtik

Celtik,


Unfortunately we cannot build you an application, we are here only to help. Can you please try in blocking mode?

More help for Blocking Property you can find here:
http://www.weonlydo.com/HttpDLX/Help/wodHttpDLXLib~wodHttpDLX~Blocking.html

You don't need to use Done Event in Blocking Mode you can receive response just after you request it. Using for example: debug.print HTTP.Response.Body after you issue for example Get Method.

Did you try perhaps using our samples?


Drazen

Re: Multi-socket

by phonehax, Sunday, July 20, 2008, 04:42 (5762 days ago) @ woddrazen

hey are u the celtik from the minimo forums?