Solved

Complex thread and STreamResponse.CanRead

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

864 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

17 Experts available now in Live!

Get 1:1 Help Now