access ARP table in Win32

Discussion in 'Perl Misc' started by perl coder, Jul 3, 2004.

  1. perl coder

    perl coder Guest

    I need to read the contents of the ARP table from a Win32 GUI program
    (ActiveState "perlapp -gui" binary). Since the -gui switch disables
    the stdin/out/err file descriptors, I can't just parse the output from
    arp.exe or even redirect it to a file. So I need a way to access the ARP
    tables from wherever arp.exe is getting its data from (presumably a system
    call). Is there a module that does this? Or does anyone happen to know
    which system call? (maybe Win32-API will work then)


    --
    No crazy stuff in my email. ;-)
     
    perl coder, Jul 3, 2004
    #1
    1. Advertising

  2. perl coder

    Petri Guest

    In article <CzEFc.2008$>, perl coder says...
    > So I need a way to access the ARP tables from wherever arp.exe
    > is getting its data from (presumably a system call).
    > Is there a module that does this?


    Why ask when you can look for yourself?

    http://search.cpan.org/search?query=ARP&mode=all

    >Or does anyone happen to know which system call? (maybe Win32-API will work
    >then)


    What did you find when you searched for it?

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iphlp/iphlp/getipnettable.asp


    Petri
     
    Petri, Jul 3, 2004
    #2
    1. Advertising

  3. perl coder

    perl coder Guest

    Purl Gurl said:
    > Arp is not a GUI program. To obtain results, don't run it
    > as an ActiveState perlapp binary.


    I was meaning that it was my program that was created with "perlapp
    -gui". :)

    > print `arp -a`;
    > print `ipconfig`;
    > system ("arp -a");
    > system ("ipconfig");


    Yeah I know all those. I even tried with Win32::process to make a
    detached process (so no console windows pop up).

    > Use of -gui with perlapp does not disable input
    > nor output, it simply creates an executable which
    > does not generate a console.


    From what I can tell so far, a "perlapp -gui" binary has no longer
    access to the standard file descriptors (STDIN, STDOUT, STDERR) and
    those file descriptors cannot exist without a console window. I ran
    several tests with such programs, trying to get output from arp.exe (and
    other console commands) and got nothing at all. Redirecting output to a
    file created an empty file.

    A little bit of googling also revealed that exe's can be linked to not
    have those file descriptors, and presumably that's what perlapp has to
    do to make a pure GUI application.

    > Run your perlapp from a DOS box or run it from your
    > command line with appropriate redirect switches
    > for output.


    Don't want any console windows on the screen. Console windows will
    freak out the users. It's for windows, so it has to be 100% GUI, and
    very very pretty with lots of clicky-clicky buttons. Blah! ;-)

    Not even minimized console windows in fact. Just pure GUI. If I could
    afford a console window, there wouldn't be any problem with calling
    arp.exe.


    --
    No crazy stuff in my email. ;-)
     
    perl coder, Jul 4, 2004
    #3
  4. perl coder

    perl coder Guest

    Petri said:
    > Why ask when you can look for yourself?


    Cause I'm programming in windows and it's making my brain hurt. :-(

    > What did you find when you searched for it?


    I found stuff about a GetIpNetTable system call that doesn't work in
    Win95 or WinNT before sevice pack 4. And apparently before that you had
    to use SNMP to access some local MIB table. That's crazy talk!

    Well at least I don't have to parse the registry. :) :) :)

    > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iphlp/iphlp/getipnettable.asp


    Thanks. But how come when I follow this URL with Lynx, Microsoft
    decides to hijack my browser and take me to this place instead:
    http://msdn.microsoft.com/library/shared/deeptree/bot/bot.asp?dtcnfg=/library/deeptreeconfig.xml

    We hates the Microsoft! We hates them!


    --
    No crazy stuff in my email. ;-)
     
    perl coder, Jul 4, 2004
    #4
  5. perl coder

    Petri Guest

    In article <ntIFc.3467$>, perl coder says...
    > I found stuff about a GetIpNetTable system call that doesn't work
    > in Win95 or WinNT before sevice pack 4.


    Tell me you aren't developing for those ancient platforms...

    > Well at least I don't have to parse the registry. :) :) :)


    Why not, that would be an easy solution at this stage.

    >>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iphlp/iphlp/getipnettable.asp


    > Thanks. But how come when I follow this URL with Lynx,
    > Microsoft decides to hijack my browser and take me to this
    > place instead:


    Why lynx if you are developing on Windows anyway?

    If you really can't catch any output with backticks, then maybe you should
    consider dumping the output of arp -a into a file and then opening that file in
    your application?
    Something like (untested):
    ---8<---
    use strict;
    use warnings;
    system('arp -a > %temp%/arp.txt');
    open my $arp, '<', "$ENV{TEMP}/arp.txt" or die "Can't open '$ENV{TEMP}/arp.txt':
    $!";
    ---8<---

    Unless system() doesn't work at all for you, of course.


    Petri
     
    Petri, Jul 4, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QXVndXN0byBDw6lzYXI=?=

    Command Arp

    =?Utf-8?B?QXVndXN0byBDw6lzYXI=?=, Feb 22, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    772
    Tampa.NET Koder
    Feb 22, 2005
  2. seb

    getting quick arp request

    seb, Sep 6, 2006, in forum: Python
    Replies:
    11
    Views:
    635
    Daniel Nogradi
    Sep 7, 2006
  3. Muhammad Farooq-i-Azam

    What is the problem with my arp structure?

    Muhammad Farooq-i-Azam, Dec 17, 2004, in forum: C Programming
    Replies:
    3
    Views:
    415
    Chris Croughton
    Dec 17, 2004
  4. Send ARP

    , Jun 21, 2007, in forum: Java
    Replies:
    0
    Views:
    672
  5. Replies:
    2
    Views:
    670
    Yu-Xi Lim
    Oct 31, 2007
Loading...

Share This Page