VB.NET网络是否联通Function
''' <summary>
''' IP Ping
''' </summary>
''' <param name="strIpOrDName">IP地址</param>
''' <returns>是否成功</returns>
''' <remarks></remarks>
Private Function PingIpOrDomainName(ByVal strIpOrDName As String) As Boolean
Dim objPingSender As New Ping
Dim objPinOptions As New PingOptions()
objPinOptions.DontFragment = True
Dim data As String = theData
Dim buffer() As Byte = Encoding.UTF8.GetBytes(data)
Dim intTimeout As Integer = 120
Dim objPinReply As PingReply = objPingSender.Send(strIpOrDName, intTimeout, buffer, objPinOptions)
Dim strInfo As String = objPinReply.Status.ToString()
If strInfo = "Success" Then
Return True
End If
Return False
End Function
上一篇: ps对称工具怎么绘制图形?