Solved

Complex thread and STreamResponse.CanRead

Posted on 2013-06-27
2
410 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
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now