multi-threading (General questions)
by help, Wednesday, December 19, 2007, 06:30 (6184 days ago)
So I'm having trouble closing the threads...
I'm doing http(Index).Disconnect but in the _Disconnected I call the other .Get's... and it still says Operation Invalid at Current State...?
is there a way to just kill a thread?
Re: multi-threading
by wodDamir, Wednesday, December 19, 2007, 08:52 (6184 days ago) @ help
Hi,
I believe you already gave yourself an answer. Move the GET's from the disconnected Event and use the Done instead, or set a condition that would only call another get (from Disconnected Event) in some certain occassions. (I.e, only if an error occured).
Also, in Disconnected Event, Set wodHttpDLX(index) = Nothing in order to release the component after disconnection.
Hope I helped.
Regards,
Damba
Re: multi-threading
by help, Wednesday, December 19, 2007, 21:20 (6183 days ago) @ wodDamir
Thanks for the fast reply! Here's what I'm doing...
Dim sck as WodHttpDLX (sock() is the wodHttpDLX.ocx on the form)
Do While blnStop = False
For Each sck In sock
DoEvents
If blnStop = False Then
If sck.State = StateNotConnected Or sck.State = StateDisconnecting Then
sck.Disconnect
tmrTimeout(sck.Index).Enabled = False
tmrTimeout(sck.Index).interval = Int(INIRead( Timeout )) * 1000
tmrTimeout(sck.Index).Enabled = True
SendTry sck.Index 'Heres the .GET
End If
End If
Next sck
Loop
This works great with Winsock, but crappy with wodHttpDLX, can I even do this with wodHttpDLX? Or am I just gonna have to code it differently? Thanks
Re: multi-threading
by woddrazen, Wednesday, December 19, 2007, 22:56 (6183 days ago) @ help
Hi,
Maybe using Blocking mode (wodHttpDLX Blocking Property set to True) is better idea. In Blocking mode commands are executed line by line without Events.
If problem persist, can you maybe zip and send us some simple sample that will duplicate your problem? You can send it to techsupport@weonlyo.com and we will try to find solution to your problem if we can.
Hope I helped.
Regards,
Drazen
Re: multi-threading
by help, Wednesday, December 19, 2007, 23:06 (6183 days ago) @ woddrazen
Thanks for all the great feedback! Blocking set to True made it a lot slower, but instead of doing multi-instances with For statement, I'm just gonna rewrite it so the control handles it a better way :]
Thanks guys