Link to home
Start Free TrialLog in
Avatar of Doug
DougFlag for United States of America

asked on

StreamReader won't timeout at readline, no end of stream character?

I'm creating a console application that uses streamwrite to write to a command window and the stream reader that reads the result.  from what I've gathered in looking through the web, the problem is that my result doesn't have an "end of stream" character ( like a crlf ) or something like that to denote the end of the stream so my application just hangs.  

I've tried to use the ReadToEnd but that fails immediately ( again maybe due to no EOS character )
There's nothing special about the end of the stream to check for.
I've tried to put it in a try catch block with no success either.

Any suggestions or solutions would be wonderful.
Do Until SR(2).EndOfStream = True
     Dim currentLine = ""
     Try
          currentLine = SR(2).ReadLine
     Catch ex As Exception
          MsgBox(ex)
     End Try
...
...
...
Loop

Open in new window

Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

do something like:
Dim currentLine as String
currentLine = SR(2).ReadLine

Do While Not currentLine is Nothing
     .....
Loop
 
ASKER CERTIFIED SOLUTION
Avatar of Doug
Doug
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Doug

ASKER

Thanks jaime, but I tried that.  It never leaves the readline line.  It stops there waiting for something to be returned.
Avatar of Doug

ASKER

Unless there are any objections, I've submitted a request to send this question to the PAQ'd section for history.