Reading Stream After RedirectStandardOutput=True Blocks

  • Thread starter Thread starter Charles Law
  • Start date Start date
C

Charles Law

If I open a DOS console window (CMD) and enter "Netdiag /v", I get periodic
output showing the progress of the diagnostic tests being run.

If I create a Windows Forms app to run Netdiag using
System.Diagnostics.Process I can only get the output in a single block. That
is to say, if I redirect standard output to a stream, I can call ReadToEnd()
on the stream and when the process has finished I get a splurge of text to
output to the screen.

If I use Peek() in a loop to see when there is a character to read, it
always returns -1. It appears that although Netdiag is generating output, it
is not getting written to the stream.

Is there some way to read the output as it is generated, rather than all in
one hit at the end? I have tried putting each of the bits in their own
threads but it doesn't seem to make any difference.

TIA

Charles
 
Charles Law said:
If I open a DOS console window (CMD) and enter "Netdiag /v", I get
periodic output showing the progress of the diagnostic tests being run.
[...]
Is there some way to read the output as it is generated, rather than all
in one hit at the end? I have tried putting each of the bits in their own
threads but it doesn't seem to make any difference.

<URL:http://dotnet.mvps.org/dotnet/samples/misc/RedirectConsole.zip>
 
Hi Herfried

Thanks for the link. I have just tried it, and it exhibits the same problem
I am now getting. It doesn't show the full output.

Try this

netdiag /v

and see what happens. The last thing you should see is "... command
completed successfully". Instead it stops short of the end, sometimes
mid-word.

Any thoughts?

Charles


Herfried K. Wagner said:
Charles Law said:
If I open a DOS console window (CMD) and enter "Netdiag /v", I get
periodic output showing the progress of the diagnostic tests being run.
[...]
Is there some way to read the output as it is generated, rather than all
in one hit at the end? I have tried putting each of the bits in their own
threads but it doesn't seem to make any difference.

<URL:http://dotnet.mvps.org/dotnet/samples/misc/RedirectConsole.zip>
 
Herfried

Can you confirm that you get the same? Is there a fix?

Charles


Charles Law said:
Hi Herfried

Thanks for the link. I have just tried it, and it exhibits the same
problem I am now getting. It doesn't show the full output.

Try this

netdiag /v

and see what happens. The last thing you should see is "... completed
successfully".
Instead it stops short of the end, sometimes mid-word.

Any thoughts?

Charles


Herfried K. Wagner said:
Charles Law said:
If I open a DOS console window (CMD) and enter "Netdiag /v", I get
periodic output showing the progress of the diagnostic tests being run.
[...]
Is there some way to read the output as it is generated, rather than all
in one hit at the end? I have tried putting each of the bits in their
own threads but it doesn't seem to make any difference.

<URL:http://dotnet.mvps.org/dotnet/samples/misc/RedirectConsole.zip>
 
Charles,

I want to show you this. Being busy with it, I saw a problem you had in past
that is done in this (Bitconverter). Beside that do in my opinion all
webbrowsers solutions interest you .

http://www.vb-tips.com/default.aspx?ID=58514c5a-5f5d-4b6d-a7bd-da738cdc7c2c

Cor

Charles Law said:
Herfried

Can you confirm that you get the same? Is there a fix?

Charles


Charles Law said:
Hi Herfried

Thanks for the link. I have just tried it, and it exhibits the same
problem I am now getting. It doesn't show the full output.

Try this

netdiag /v

and see what happens. The last thing you should see is "... completed
successfully".
Instead it stops short of the end, sometimes mid-word.

Any thoughts?

Charles


Herfried K. Wagner said:
If I open a DOS console window (CMD) and enter "Netdiag /v", I get
periodic output showing the progress of the diagnostic tests being run.
[...]
Is there some way to read the output as it is generated, rather than
all in one hit at the end? I have tried putting each of the bits in
their own threads but it doesn't seem to make any difference.

<URL:http://dotnet.mvps.org/dotnet/samples/misc/RedirectConsole.zip>
 
Hi Cor

Yes, they do, although I am not currently working in that area, I still play
around with it from time-to-time.

Charles


Cor Ligthert said:
Charles,

I want to show you this. Being busy with it, I saw a problem you had in
past that is done in this (Bitconverter). Beside that do in my opinion all
webbrowsers solutions interest you .

http://www.vb-tips.com/default.aspx?ID=58514c5a-5f5d-4b6d-a7bd-da738cdc7c2c

Cor

Charles Law said:
Herfried

Can you confirm that you get the same? Is there a fix?

Charles


Charles Law said:
Hi Herfried

Thanks for the link. I have just tried it, and it exhibits the same
problem I am now getting. It doesn't show the full output.

Try this

netdiag /v

and see what happens. The last thing you should see is "... completed
successfully".
Instead it stops short of the end, sometimes mid-word.

Any thoughts?

Charles


If I open a DOS console window (CMD) and enter "Netdiag /v", I get
periodic output showing the progress of the diagnostic tests being
run.
[...]
Is there some way to read the output as it is generated, rather than
all in one hit at the end? I have tried putting each of the bits in
their own threads but it doesn't seem to make any difference.

<URL:http://dotnet.mvps.org/dotnet/samples/misc/RedirectConsole.zip>
 
Back
Top