Hi,
have just been looking at a bit of code submitted by Gigemboy to redivert the results from a cmd prompt. I want to use this to check to see if a server is running by pinging it and seeing how many packets were returned.
Anyway am waffaling a bit, my main questions is how to make this more .net like, eg not using mid and instr.
Had a quick look at the string class but can't see any equivalants (sure I'm just missing them though)
VB Code:
Private Function succesfulping(ByVal cmdp As String) As Boolean Dim recp As Integer Dim pacr As Integer recp = InStr(cmdp, "Received") + 11 Try pacr = CInt(Mid(cmdp, recp, 1)) Catch pacr = 0 End Try Select Case pacr Case 0 succesfulping = False Case 1 succesfulping = False Case 2 succesfulping = False Case 4 succesfulping = True Case Else succesfulping = False End Select End Function




Reply With Quote