Solved

Complex thread and STreamResponse.CanRead

Posted on 2013-06-27
2
417 Views
Last Modified: 2013-06-27
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
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 39281408
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
 

Author Closing Comment

by:lrbrister
ID: 39281419
CodeCruiser.

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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question