need help with ping program
hi,
i need to replicate the ping in command prompt. i'm currently using the following:
Code:
Try
If My.Computer.Network.Ping(mtbIPAddress.Text) Then
rtbLog.AppendText("Response")
Else
rtbLog.AppendText("Reject")
End If
Catch ex As Exception
rtbLog.AppendText("Reject")
End Try
but i need to get the same response as the ping in command prompt ie..
Code:
Pinging www.l.google.com [74.125.71.104] with 32 bytes of data:
Reply from 74.125.71.104: bytes=32 time=240ms TTL=53
Reply from 74.125.71.104: bytes=32 time=313ms TTL=53
Reply from 74.125.71.104: bytes=32 time=256ms TTL=53
Request timed out.
Reply from 74.125.71.104: bytes=32 time=251ms TTL=53
how do i get the bytes, time and TTL?
thanks
Re: need help with ping program
Try the following code
Code:
Imports System.Net.NetworkInformation
=================================
Dim Ping As New Ping
Dim PingOptions As New PingOptions
PingOptions.Ttl = 64
Dim PingReply As PingReply = Ping.Send("192.168.1.1", 500)
If PingReply.Status = IPStatus.Success Then
MsgBox(PingReply.Options.Ttl)
MsgBox(PingReply.Buffer.Length)
End If
Re: need help with ping program
thanks.
just an additional question. i noticed that when i pinged www.google.com it showed me a notification pinging www.l.google.com? where did the www.l.google.com come from?
Re: need help with ping program
Re: need help with ping program
Re: need help with ping program
Quote:
Originally Posted by
adshocker
Why are you pinging Google? (dewayne asks, warming up the soapbox) See my signature.
Re: need help with ping program
i was just curious because if in case the user will enter a domain instead of an ip address, which domain should i get the ip address from. getting the ip address is another issue though.
Re: need help with ping program
What does what you said have to do with pinging Google? DNS is responsible for getting IP addresses associated with names and names associated with IP addresses.