weixin_45884524 2019-11-15 17:49
浏览 155

vb.net获取不到iperf返回的数据 ,求各位大神帮忙。

本人对编程懂的不多,求各位大神帮忙:
我想通过vb.net获取iperf测试返回的数据,但是现在只能获取到dos的内容,执行ping的话,收到的数据是正常的,而iperf的数据收不到,而且还会弹出dos窗口。麻烦帮忙看一下是怎么回事?
我的代码:

Private Sub TS_Start_Click(sender As Object, e As EventArgs) Handles TS_Start.Click
Try
            myProcess.Refresh()
            newThread = New Thread(AddressOf ThreadExcuteDos)
            newThread.Start()
            B_Folder.Enabled = False
            B_Start.Enabled = False
            B_Ping.Enabled = False
            TS_Ping.Enabled = True
            TS_Start.Enabled = True
            TS_Stop.Enabled = True
            T_Folder.ReadOnly = True
            T_IP.ReadOnly = True
            T_TestTime.ReadOnly = True
   Catch ex As Exception
            MessageBox.Show(ex.Message)
   End Try
End Sub
Sub ThreadExcuteDos() '
        myProcess.StartInfo.FileName = "cmd.exe"
        myProcess.StartInfo.UseShellExecute = False
        myProcess.StartInfo.RedirectStandardInput = True
        myProcess.StartInfo.RedirectStandardOutput = True
        myProcess.StartInfo.RedirectStandardError = True
        myProcess.StartInfo.CreateNoWindow = True
        AddHandler myProcess.OutputDataReceived, AddressOf DataReceivedHandler
        myProcess.Start()
        myProcess.BeginOutputReadLine()   
        myProcess.StandardInput.WriteLine(cmd)
        myProcess.WaitForExit()
        myProcess.Close()
    End Sub
         Private Sub UpdateResult(ByVal strText As String)
        TextBox1.AppendText(strText + Environment.NewLine)
        If IsNothing(strText) Then
            myProcess.CancelOutputRead()
        End If
    End Sub
            Private Sub DataReceivedHandler(sender As Object, outLine As DataReceivedEventArgs)
        Me.Invoke(New updateShow(AddressOf UpdateResult), outLine.Data)
    End Sub
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 ubuntu虚拟机打包apk错误
    • ¥199 rust编程架构设计的方案 有偿
    • ¥15 回答4f系统的像差计算
    • ¥15 java如何提取出pdf里的文字?
    • ¥100 求三轴之间相互配合画圆以及直线的算法
    • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
    • ¥15 名为“Product”的列已属于此 DataTable
    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发