一个项目必须依赖telnet成功之后才能正常使用,怎么实现telnet判断是否成功弄呢?
怎么增加如果telnet通了 就运行exit 并打开项目 反之就提示用户 telnet不通 同时提示用户当前项目不可用
当前代码如下:
Dim p As new Process()
p.StartInfo.FileName = "cmd.exe"
p.StartInfo.UseShellExecute = False '关闭Shell的使用
p.StartInfo.RedirectStandardInput = True '重定向标准输入
p.StartInfo.RedirectStandardOutput = True '重定向标准输出
p.StartInfo.RedirectStandardError = True '重定向错误输出
p.StartInfo.CreateNoWindow = False '设置不显示窗口
p.Start()
p.StandardInput.WriteLine( "telnet 218.201.202.174 8900")
'怎么增加如果telnet通了 就运行exit 并打开项目 反之就提示用户 telnet不通 同时提示用户当前项目不可用
p.StandardInput.WriteLine("exit")