Solved

Output Streamreader

Posted on 2013-06-18
5
216 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 500 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
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 …
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…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

705 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