473,322 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Reading Stream After RedirectStandardOutput=True Blocks

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
Mar 16 '06 #1
6 2302
Problem solved. A great example can be found here (The Code Project) for
anyone who is interested.

http://209.171.52.99/csharp/LaunchPr...asp?print=true

Charles
"Charles Law" <bl***@nowhere.com> wrote in message
news:eh**************@TK2MSFTNGP10.phx.gbl...
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

Mar 16 '06 #2
"Charles Law" <bl***@nowhere.com> schrieb:
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>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Mar 16 '06 #3
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 [MVP]" <hi***************@gmx.at> wrote in message
news:e1**************@tk2msftngp13.phx.gbl...
"Charles Law" <bl***@nowhere.com> schrieb:
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>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Mar 16 '06 #4
Herfried

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

Charles
"Charles Law" <bl***@nowhere.com> wrote in message
news:uX**************@TK2MSFTNGP12.phx.gbl...
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 [MVP]" <hi***************@gmx.at> wrote in message
news:e1**************@tk2msftngp13.phx.gbl...
"Charles Law" <bl***@nowhere.com> schrieb:
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>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


Mar 17 '06 #5
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?...d-da738cdc7c2c

Cor

"Charles Law" <bl***@nowhere.com> schreef in bericht
news:ul*************@TK2MSFTNGP12.phx.gbl...
Herfried

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

Charles
"Charles Law" <bl***@nowhere.com> wrote in message
news:uX**************@TK2MSFTNGP12.phx.gbl...
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 [MVP]" <hi***************@gmx.at> wrote in message
news:e1**************@tk2msftngp13.phx.gbl...
"Charles Law" <bl***@nowhere.com> schrieb:
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>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>



Mar 17 '06 #6
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 [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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?...d-da738cdc7c2c

Cor

"Charles Law" <bl***@nowhere.com> schreef in bericht
news:ul*************@TK2MSFTNGP12.phx.gbl...
Herfried

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

Charles
"Charles Law" <bl***@nowhere.com> wrote in message
news:uX**************@TK2MSFTNGP12.phx.gbl...
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 [MVP]" <hi***************@gmx.at> wrote in message
news:e1**************@tk2msftngp13.phx.gbl...
"Charles Law" <bl***@nowhere.com> schrieb:
> 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>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>



Mar 17 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: John Lewin | last post by:
I've recently discovered the value of using existing console applications in managed .net apps. Unfortunately, I've stumbled into a problem with a particular console application that check's crc...
0
by: CMG | last post by:
I am trying to run gocr from my program, and use the output. I have done this with success befor, with a workaround command line tool.: Private irfanview As String = "C:\program...
1
by: Yash | last post by:
Hi, Through my VB .NET code , I am trying to invoke a perl script. My aim is to write lines to the script and read from it. With ProcInfo .Arguments = Enricher.EnrichScript + " " + enArgs...
0
by: CMG | last post by:
I am trying to run gocr from my program, and use the output. I have done this with success befor, with a workaround command line tool.: Private irfanview As String = "C:\program...
4
by: Kevin Mansel via .NET 247 | last post by:
Ok, basically this is my problem. I'm building a console app tocall a dos program. So i'm using the Shell command to call theprogram, now depending on what happens, I want to read theoutput that...
6
by: Charles Law | last post by:
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...
5
by: Mikko Nylén | last post by:
Hi!, I'm trying to read the output of an process as it gets executed and append the output to a RichTextBox. However, I have a little problem: the process I'm trying to execute is a Python...
2
by: ShieldsJared | last post by:
Hello all, So I recently found out about redirecting the Standard Output of a vbscript back to my C# app but I've found a problem. When I run a script that calls OpenTextFile, I do not receive...
5
MMcCarthy
by: MMcCarthy | last post by:
Hi guys, I know I must be missing something obvious here. Can anyone spot why the if statement is not reading true. Function checkCummLeave(dateCheck As Date, dayAmt As Integer) Dim db As...
9
by: Pheddy | last post by:
Hey all! Is it possible to read blocks of a .asp file in that way that my page have the following three fields: hey.asp: ptitel="hej" pbody="yeah" pbottom="you read this.." So i wanna...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.