intergrating telnet through System.Diagnostics.Pro
What I try to accomplish is to run "telnet.exe" as a process in C#.
The C#-code below works with terminating commands, e.g. a
Since I'd like to communicate with "telnet" the process is still
running when I already have to read from the stream. This seems to be
the problem, since "myStreamReader.ReadLine()" is waiting for
Is there a chance to force the underlying pipe to flush its output (at
least the password line should be there), so that I can read
static void Main(string args)
Process myProcess = new Process();
ProcessStartInfo myProcessStartInfo = new
myProcessStartInfo.UseShellExecute = false;
myProcessStartInfo.RedirectStandardOutput = true;
myProcessStartInfo.RedirectStandardInput = true;
myProcess.StartInfo = myProcessStartInfo;
StreamReader myStreamReader = myProcess.StandardOutput;
StreamWriter myStreamWriter = myProcess.StandardInput;
// problem, here it hangs
// Read() and ReadToEnd() also hangs!
string myString = myStreamReader.ReadLine(); <=PROBLEM ?
Purpose of the application:
What I want to do is call a remote application, read the telnet
stream, search for a string (e.g. password) and respond (e.g. by
sending he "pw")
The reason why I do not want to use a library is that I have to extend
the programm later using ssh, rsh ...