i want to store PING status in VB or VC

himanshu1

Beta member
Messages
1
Hi, I am totally new to this forum. I want to develop program that can store ping command status in text file, like link is up or down only at particular time interval in VB or VC

plz help me
 

David Lindon

Golden Master
Messages
15,233
Hi himanshu, It seems very simple what you want to do but unfortunately, I don't know VB. Sorry I can't be of any more help.
 

Steveswaldo

Baseband Member
Messages
25
this should get you started (its off something else i made, in which i modded some other code)


Public Function obtainip() As String
On Error GoTo errormsg

If ipopt = True Then
ipaddress = CInt(iptxt1.Text) & "." & CInt(iptxt2.Text) & "." & CInt(iptxt3.Text) & "." & CInt(iptxt4.Text)
obtainip = ipaddress
'Determine the class of the ip address
If CInt(iptxt1.Text) < 127 Then
classlbl.Caption = "Class A IP"
End If

If CInt(iptxt1.Text) = 127 Then
classlbl.Caption = "Loopback Address"
End If

If CInt(iptxt1.Text) > 127 And CInt(iptxt1.Text) < 192 Then
classlbl.Caption = "Class B IP"
End If

If CInt(iptxt1.Text) > 191 And CInt(iptxt1.Text) < 224 Then
classlbl.Caption = "Class C IP"
End If
Else
obtainip = urltxt.Text
End If

Exit Function
errormsg:
MsgBox ("Not a valid input - Check internet connection too")
End Function



Private Sub pngcmd_Click()
ReadL.Text = ""
Dim shlcmd, comstring, IP, outpath As String

IP = obtainip
outpath = App.Path & "\ping.txt" 'Can be whereever you want
DoEvents
comstring = "command.com /c ping -a " & IP & " > " & outpath
shlcmd = Shell(comstring, vbHide)

'MsgBox ("Output has been saved to " & outpath & vbCrLf & "(Local Path)")
Timer2.Interval = 12000
stat1.Caption = "Loading......"
End Sub
 
Top Bottom