?
Solved

Output Streamreader

Posted on 2013-06-18
5
Medium Priority
?
217 Views
Last Modified: 2013-06-24
I have an HTTP POST  using
 Dim myHttpWebRequest As HttpWebRequest = CType(WebRequest.Create(stUrl), HttpWebRequest)

After posting the WebRequest

I have this
Dim streamResponse As Stream = myHttpWebResponse.GetResponseStream()
Dim streamRead As New StreamReader(streamResponse)

How do I gkeep my connection open and just receive Debug.Writeline everything that comes through...never closing the connection?

I can receive the first "chunk" no problem using the following code...but it will exit after the first chunk
Dim streamResponse As Stream = myHttpWebResponse.GetResponseStream()
        Dim streamRead As New StreamReader(streamResponse)
        Dim readBuff(12560) As [Char]
        Dim count As Integer = streamRead.Read(readBuff, 0, 12560)

        Debug.WriteLine(count)
        Debug.WriteLine(ControlChars.Cr + "The contents of the HTML page are :  ")
        If count = 0 Then
            GoTo TheStart
        Else
            While count > 0
                Dim outputData As New [String](readBuff, 0, count)
                Debug.WriteLine(outputData)
                count = streamRead.Read(readBuff, 0, 12560)
            End While
        End If

Open in new window


Edit:
http://www.experts-exchange.com/R_21101.html
Modulus_Twelve
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
  • 3
  • 2
5 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 39270906
Set the KeepAlive property of request to true and then call Read method of ReponseStream in a loop.
0
 

Author Comment

by:lrbrister
ID: 39271246
CodeCruiser,
  I have the KeepAlive set to true already.

How do I do the loop on the response stream?
Doesn't it require a buffer?
0
 

Author Closing Comment

by:lrbrister
ID: 39271348
CodeCruiser...

Added this...

While streamResponse.CanRead

And refreshed the buffer inside each cycle on the output

THANKS!!!!

Remind me to buy you a Sody-Pop!

Been on this for 10 days
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39271379
Glad it worked :-)
0
 

Author Comment

by:lrbrister
ID: 39271388
Man...I tell you what.

I went bin circles for a while.  Thanks...You know how it is when you're too close to something

Fresh eyes are needed.
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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…
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

771 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