• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 426
  • Last Modified:

Complex thread and STreamResponse.CanRead

I have a While statement that starts separate threads in code.
Anywhere from 5 to 10 threads

In each thread I have a HttpWebResponse and GetResponseStream with the stream left in an OPEN state with the canread (See code below)

I need to have some way of determining if a particular stream closes...OR the thread closes or fails. (Terminology???)


So inside sub 1
Dim th As New Thread(AddressOf startPhoneMonitoring)
th.Start(sendRow)

Open in new window


And inside the startPhoneMonitoring sub
' The response object of 'HttpWebRequest' is assigned to a 'HttpWebResponse' variable. 
Using myHttpWebResponse As HttpWebResponse = CType(sendWebRequest.GetResponse(), HttpWebResponse)

     ' Displaying the contents of the page to the consoleor sending to web service/sql proc 
     Using streamResponse As Stream = myHttpWebResponse.GetResponseStream()

          'Next Line tricks into staying in Response Stream Loop
          While streamResponse.CanRead
                 etc...

Open in new window

0
lrbrister
Asked:
lrbrister
1 Solution
 
CodeCruiserCommented:
For thread, you can start another thread which keeps monitoring the ThreadState of all of these worker threads.

Not sure about the http connection though.
0
 
lrbristerAuthor Commented:
CodeCruiser.

Thanks. I'll do a little grunt work and get that in place.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now