Re: Using binary data with process.standardInput/StandardOutput
- From: "Nick Malik [Microsoft]" <nickmalik@xxxxxxxxxxxxxxxxxx>
- Date: Tue, 26 Jul 2005 06:32:28 -0700
Ah. I didn't think of that, but it makes perfect sense. I haven't solved
this problem before, but I've sure seen it.
History lesson: The notion of stdin and stdout comes from Unix. It was
adopted into DOS in its early days when C was becoming a popular way to
write programs for DOS. In Unix (of the time), stdin and stdout were simply
buffered pipes. In other words, you have a specific buffer size and, when
it is full, the process sending the data would be stopped until the process
receiving the data caught up and consumed it. DOS did its best to emulate
that. For the most part, they succeeded.
The problem is that this mechanism was designed for one app to pipe to
another, not for a controller app to pipe to a child. In other words, you
are supposed to give the command: "myapp | nextapp" at the command line, and
let DOS handle the controlling. In this context, 'myapp' is triggered and
runs until the buffer fills up. Then, 'nextapp' runs until the buffer is
largely consumed. Then 'myapp' continues until the buffer is full again...
and the dance goes on.
You haven't recreated this interaction in your app. Therefore, the buffer
fills and everything stops.
You could solve this by having a portion of your app run standalone, and use
the "pipe" notation above. Not elegant.
Alternative: write all of the data to a file and issue the command using the
"<" notation:
In other words, create a file that you intend to feed into input (I'll call
it "mytempfile.dat") and then issue the command:
"nextapp <mytempfile.dat"
Hope this helps
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Hanika" <Hanika@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A82B776A-9082-4D4C-9849-16E1D144BCF2@xxxxxxxxxxxxxxxx
> Thanks for your response.
>
> I changed my code to use binary reader and access the basestream. I have
> run into a new problem: The basestream write gets stuck when I try
> propcessing files pver aprox 60 KB. It works fine for files under that
> size.
> Here is my code:
>
<<code clipped>>
.
- Follow-Ups:
- Re: Using binary data with process.standardInput/StandardOutput
- From: David Levine
- Re: Using binary data with process.standardInput/StandardOutput
- References:
- Using binary data with process.standardInput/StandardOutput
- From: Hanika
- Re: Using binary data with process.standardInput/StandardOutput
- From: Nick Malik [Microsoft]
- Re: Using binary data with process.standardInput/StandardOutput
- From: Hanika
- Using binary data with process.standardInput/StandardOutput
- Prev by Date: Running VS2005 web app on framework 1.1?
- Next by Date: COM+ returns Logon failure: unknown user name or bad password
- Previous by thread: Re: Using binary data with process.standardInput/StandardOutput
- Next by thread: Re: Using binary data with process.standardInput/StandardOutput
- Index(es):
Relevant Pages
|