473,399 Members | 2,278 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,399 software developers and data experts.

Redirect StandartOutput and StandardInput at the same time without closing the executive

Hi all,

Thanks for reading my post!!!

I am facing a problem that I cannot redirect StandartOutput and
StandardInput at the same time without closing the executive.

Actually, I have a console application named "etm.exe", I would like
to call it in my .net (VC) application. What I want to do is when the
user type some command in my .net application, I redirect this command
to etm.exe and also redirect the output of "etm.exe" to my .net
application. Also, I need the "etm.exe" not to be closed until I close
my .net application.

I have tried by using "process" class, I can redirect the input and
output. However, the "etm.exe" is closed every time a single command
completed.

Has anyone tried to develop a similar application?
Thanks in advance. Your help is greatly appreicated!!!

Ivan Lam
Nov 19 '05 #1
2 3165
Couple things to look for.

In your etm.exe are you ever calling Console.Out.Flush()? This will flush
what is in the buffer to the Stream.

In your application how are you redirecting the standard output?

Process p;
p.StandardOutput.ReadToEnd().

If you are calling ReadToEnd, it will not read it until I think the stream
is closed. ie the etm.exe has exited. You might want to look at some other
methods Read, ReadLine to get better functionality.

The only time you can send information easily to another process is through
the process start info object. You can only pass command arguments to the
exe.

To pass commands to the etm.exe while it is running, you will have to look
into remoting, or some sort of RPC call to send commands to a seperate
process.

So this might have not helped you at all, but hopefully you have more
insight into your problem.

bill

"Ivan Lam" <iv*****@hkem.com> wrote in message
news:77*************************@posting.google.co m...
Hi all,

Thanks for reading my post!!!

I am facing a problem that I cannot redirect StandartOutput and
StandardInput at the same time without closing the executive.

Actually, I have a console application named "etm.exe", I would like
to call it in my .net (VC) application. What I want to do is when the
user type some command in my .net application, I redirect this command
to etm.exe and also redirect the output of "etm.exe" to my .net
application. Also, I need the "etm.exe" not to be closed until I close
my .net application.

I have tried by using "process" class, I can redirect the input and
output. However, the "etm.exe" is closed every time a single command
completed.

Has anyone tried to develop a similar application?
Thanks in advance. Your help is greatly appreicated!!!

Ivan Lam

Nov 19 '05 #2
We are working on getting access to a running process in an ASP.NET Web App
which needs to access a running process, send messages to it, on different
requests. What we did was create the process on the first request, then
withing the .exe itself, we had a while loop like while((read =
Console.ReadLine()) != null) This seems to keep the .exe running and
accepting input. Using that, we were able to have our asp.net grab hold of
the running process, and send it commands pretty easily. If you have anymore
input on this we have some issues on it we've been battling for ASP.NET such
as how to grab hold of the StandardInput Stream on a second request since the
stream is closed. Right now we cache an opened StreamWriter object but that
seems a little brittle. Any ideas on that one?

Christopher

"Ivan Lam" wrote:
Hi all,

Thanks for reading my post!!!

I am facing a problem that I cannot redirect StandartOutput and
StandardInput at the same time without closing the executive.

Actually, I have a console application named "etm.exe", I would like
to call it in my .net (VC) application. What I want to do is when the
user type some command in my .net application, I redirect this command
to etm.exe and also redirect the output of "etm.exe" to my .net
application. Also, I need the "etm.exe" not to be closed until I close
my .net application.

I have tried by using "process" class, I can redirect the input and
output. However, the "etm.exe" is closed every time a single command
completed.

Has anyone tried to develop a similar application?
Thanks in advance. Your help is greatly appreicated!!!

Ivan Lam

Nov 19 '05 #3

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

Similar topics

2
by: Todd Lu | last post by:
I am trying to redirect a login page to another page after validating the username and password. I am currently trying to use javascript with the window.open command but this leaves the...
2
by: O_Spring | last post by:
I am writing a program in c#. I would like to read a binary file to the standard input of a process (it is flac.exe to encode/decode some files). I have tried to use the following code : ...
1
by: Christopher. A. Kelly | last post by:
I'm trying to send a string to a 3rd party application without using the sendmessage api below is what I am trying but it kicks out saying that StandardInput is redirected. I know that it is...
1
by: Panagiotis | last post by:
Hi everyone, this is what I want to do in C#: 1) start a Cygwin Bash Shell 2) send the Shell a command, for example "ls -l" 3) capture all the output of the command The code below seems to...
4
by: Zenon | last post by:
I have a C# application which interacts with an HP UNIX box via PSFTP. I have run in to a problem where the maximum amount of characters I can redirect is 1024. This number leads me to believe...
3
by: KL | last post by:
I am trying to get a form to work with validating a checkbox. It validates the checkbox ok, but it always redirects, even if the box isn't checked...it does alert, but I was hoping that it would...
1
by: rouellette | last post by:
Is it possible to redirect to another page in your application from the start page BEFORE the user has been authenticated if you're using FORMS authentication? I can't seem to get it to work. ...
2
by: nautonnier | last post by:
Hello, I have a C# app that spawns several processes each containing a console app written by another developer in C++. The console app was written first to be just like a console app: it...
0
by: shravagiparag | last post by:
Hello, I am developing a console application to invoke gdb session and log in the communication between my application and gdb. I opened gdb as a new process and tried to redirect the input and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.