How to ping another computer in Vb.net 2003

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Robert Dufour

    #1

    How to ping another computer in Vb.net 2003

    Its easy in 2005 but I'm stuck with 2003 for now

    Can anyone provide a snippet of code?
    Thanks for any help.
    Bob


  • Michael M.

    #2
    Re: How to ping another computer in Vb.net 2003

    Robert.

    if it's not built in then you probably need to use API check out the
    IPHLPAPI.DLL (IP helper API)

    it has alot of the IGMP protocol stuff in it.

    Michael.
    "Robert Dufour" <bdufour@sgiims .comwrote in message
    news:Ohi$lFqMHH A.2236@TK2MSFTN GP02.phx.gbl...
    Its easy in 2005 but I'm stuck with 2003 for now
    >
    Can anyone provide a snippet of code?
    Thanks for any help.
    Bob
    >

    Comment

    • Terry Olsen

      #3
      Re: How to ping another computer in Vb.net 2003

      When I had to do it in 2003, I just used an external program called
      fping.exe and read back it's output.

      "Robert Dufour" <bdufour@sgiims .comwrote in message
      news:Ohi$lFqMHH A.2236@TK2MSFTN GP02.phx.gbl...
      Its easy in 2005 but I'm stuck with 2003 for now
      >
      Can anyone provide a snippet of code?
      Thanks for any help.
      Bob
      >

      Comment

      • =?Utf-8?B?cGhpbC5k?=

        #4
        RE: How to ping another computer in Vb.net 2003

        You can use WMI (add referrence/import to system.manageme nt)

        Dim objPing As New SelectQuery("SE LECT StatusCode FROM Win32_PingStatu s
        where address='" & machinename_or_ ipaddress & "'")
        Dim objSearch as New ManagementObjec tSearcher(objPi ng)
        Dim PingStatus As String = ""
        For Each objItem as In objSearch.Get()
        PingStatus = objItem("Status Code").ToString
        Next
        if PingStatus <"0" Then
        ' failed
        else
        'success
        end if

        HTH,

        Phil
        "Robert Dufour" wrote:
        Its easy in 2005 but I'm stuck with 2003 for now
        >
        Can anyone provide a snippet of code?
        Thanks for any help.
        Bob
        >
        >
        >

        Comment

        • Cor Ligthert [MVP]

          #5
          Re: How to ping another computer in Vb.net 2003

          You can forever use the application start.

          \\\
          Dim p As New Process
          Dim pi As New ProcessStartInf o
          pi.UseShellExec ute = False
          pi.RedirectStan dardOutput = True
          pi.Arguments = "www.google.com "
          pi.WorkingDirec tory = "C:\windows\sys tem32"
          'this for nt* computers
          pi.FileName = "ping"
          p.StartInfo = pi
          p.StartInfo = pi
          p.Start()
          Dim sr As IO.StreamReader = p.StandardOutpu t
          Dim sb As New System.Text.Str ingBuilder("")
          Dim input As Integer = sr.Read
          Do Until input = -1
          sb.Append(ChrW( input))
          input = sr.Read
          Loop
          MessageBox.Show (sb.ToString)
          ///

          Cor


          Comment

          • Robert Dufour

            #6
            Re: How to ping another computer in Vb.net 2003

            Thank you folks, been a great help.
            Bob
            "Cor Ligthert [MVP]" <notmyfirstname @planet.nlwrote in message
            news:epJDIXuMHH A.536@TK2MSFTNG P02.phx.gbl...
            You can forever use the application start.
            >
            \\\
            Dim p As New Process
            Dim pi As New ProcessStartInf o
            pi.UseShellExec ute = False
            pi.RedirectStan dardOutput = True
            pi.Arguments = "www.google.com "
            pi.WorkingDirec tory = "C:\windows\sys tem32"
            'this for nt* computers
            pi.FileName = "ping"
            p.StartInfo = pi
            p.StartInfo = pi
            p.Start()
            Dim sr As IO.StreamReader = p.StandardOutpu t
            Dim sb As New System.Text.Str ingBuilder("")
            Dim input As Integer = sr.Read
            Do Until input = -1
            sb.Append(ChrW( input))
            input = sr.Read
            Loop
            MessageBox.Show (sb.ToString)
            ///
            >
            Cor
            >

            Comment

            Working...