我使用System.Net.NetworkInformation.PingReply和System.Net.NetworkInformation.PingOptions在vb.net中编写一个简单的ping命令。但是PingOptions.Ttl总是显示128作为输出。以下是我的代码的一部分:
Dim buffer As Byte() = Encoding.ASCII.GetBytes(data)
Dim Myreply As System.Net.NetworkInformation.PingReply = MyPing.Send("10.99.162.201", 1000, buffer, options)
If Myreply.Status = Net.NetworkInformation.IPStatus.Success Then
PingResult = ("Reply from" & " " & Myreply.Address.ToString & ":" & _
"bytes=" & Myreply.Buffer.Length.ToString & _
" " & "time=" & Myreply.RoundtripTime.ToString & "ms" & " " & "TTL=" & options.Ttl)
ElseIf Myreply.Status = Net.NetworkInformation.IPStatus.TimedOut Then
PingResult = ("Request timed out.")
Else
PingResult = ("Error")
End If
有人可以帮助我检查缺少什么来获得正确的结果吗?感谢。
答案 0 :(得分:0)
Windows操作系统 TTL为128
和Linux的TTL是64