Results 1 to 8 of 8

Thread: need help with ping program

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    403

    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

    VB Version: Microsoft Visual Studio 2008 Professional Edition
    .NET Version: Microsoft .NET Framework Version 3.5
    OS: Windows XP SP3

  2. #2
    Fanatic Member amrita's Avatar
    Join Date
    Jan 2007
    Location
    Orissa,India
    Posts
    888

    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
    thanks
    amrita

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    403

    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?

    VB Version: Microsoft Visual Studio 2008 Professional Edition
    .NET Version: Microsoft .NET Framework Version 3.5
    OS: Windows XP SP3

  4. #4
    Frenzied Member Pc_Not_Mac's Avatar
    Join Date
    Oct 2009
    Location
    localhost
    Posts
    1,206

    Re: need help with ping program

    My Codebank:
    Windows Vista & 7 Glass Effect & Limit the amount of times your application could be opened.
    Pause Your Code & Check the OS name

    The question of whether computers can think is like the question of whether submarines can swim.

    Currently learning: Java

    Coding can be a learning experience or

  5. #5
    Fanatic Member amrita's Avatar
    Join Date
    Jan 2007
    Location
    Orissa,India
    Posts
    888

    Re: need help with ping program

    thanks
    amrita

  6. #6
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: need help with ping program

    Quote Originally Posted by adshocker View Post
    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?
    Why are you pinging Google? (dewayne asks, warming up the soapbox) See my signature.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    403

    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.

    VB Version: Microsoft Visual Studio 2008 Professional Edition
    .NET Version: Microsoft .NET Framework Version 3.5
    OS: Windows XP SP3

  8. #8
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    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.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width