Note: I'm posting this question in this category in hopes that I will get an answer. It is also posted in VB.net... but the question doesn't quite fit a category in my mind. I will close whichever question gets no answers.
Basically I'm working on a program in VB.net which will:
1. Connect to telnet server
2. Continue sending input throughout the telnet session... input which depends on:
3. Retrieving output from the session.
Thus far, I have this:
p = New Process
p.StartInfo.RedirectStanda
rdOutput = True
p.StartInfo.RedirectStanda
rdInput = True
p.StartInfo.CreateNoWindow
= True
p.StartInfo.UseShellExecut
e = False
p.StartInfo.FileName = "cmd.exe"
p.Start()
out = p.StandardOutput 'out is a streamreader
inn = p.StandardInput 'inn is a streamwriter
inn.AutoFlush = True
inn.Write("telnet" & vbCrLf)
RichTextBox1.Text = out.ReadLine() & vbCrLf
RichTextBox1.Text &= out.ReadLine() & vbCrLf
RichTextBox1.Text &= out.ReadLine() & vbCrLf
RichTextBox1.Text &= out.ReadLine() & vbCrLf
RichTextBox1.Text &= out.ReadLine() & vbCrLf
My output is:
-------------Start--------
---------
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Prog\Telnet Prog\bin>telnet
-------------End----------
----------
-
But, RichTextBox1 should show the telnet info I would think...
However, I do realize that the telnet command starts up a telnet.exe process which may "overlay" the command prompt.
That doesn't change the fact that I can start up cmd.exe in shellmode and use the system.windows.forms.sendk
eys command to send input to telent through cmd.exe.
If i do it this way, however, all I can do is provide input - I cannot analyze output.
So... the big question.
How can interactively provide input and output to telnet?
Start Free Trial