dcsimg
Results 1 to 5 of 5

Thread: [RESOLVED] Need help executing an "arp -a" command

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2013
    Posts
    106

    Resolved [RESOLVED] Need help executing an "arp -a" command

    The code below is an attempt to read the output of an "arp -a" command. It is a simple form with two buttons, one for executing the command and the other for quitting the program. I expected to see a DOS command window pop up for just a second and then the output of the arp command showing up in the rawData string. What actually happens is clicking Button1 causes a copy of the form to pop up. Clicking that form's Button1 causes another copy to pop up, etc.

    What am I doing wrong?

    Code:
    Imports System.Net
    Public Class Form1
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            ' Get IP Address And Mac Address
            Dim proc As Process
            Dim rawData As String
    
            Dim psi As New ProcessStartInfo With {
                .FileName = "arp",
                .Arguments = "-a " + "192.168.1.25",
                .UseShellExecute = False,
                .RedirectStandardOutput = True
            }
            proc = Process.Start(psi)
            rawData = proc.StandardOutput.ReadToEnd()
        End Sub
    
        Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
            Application.Exit()
        End Sub
    End Class

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,382

    Re: Need help executing an "arp -a" command

    Just for fun... what's the name of your app? Is it "arp" by chance?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2013
    Posts
    106

    Re: Need help executing an "arp -a" command

    Holy molly, you are right. Now that was a really bonehead move on my part.

    Thanks!

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,382

    Re: [RESOLVED] Need help executing an "arp -a" command

    It was the only thing I could think of. There wasn't anything in your code creating new copies of the form, so the only explanation I could think of was that you were spawning up new instances of your app... and the only way that could happen is if it was names arp as well.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Nov 2013
    Posts
    106

    Re: [RESOLVED] Need help executing an "arp -a" command

    That was one of my more creative ways to trip myself up. Thanks for figuring it out.

Tags for this Thread

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width