Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Using Java to extract WiFI card Info.......

Options
  • 17-02-2005 9:04pm
    #1
    Registered Users Posts: 194 ✭✭


    I need to get the default gateway that my PDA is using.

    I have a batch file that will extract the Default gateway to a '.txt' file but I can't seem to get it working through pocketdos for my Dell Axim x30.

    SO, another soultion may be to use Java.

    It possible to extract network info from a WiFi card through Java??

    Can Java extract network info similar to the "ipconfig" and "arp" commands that dos offers?

    Cheers,

    pbarry....


Comments

  • Posts: 0 [Deleted User]


    I hope this helps, your problem sounds like something I had to do last year...

    In Java, there is a method, exec(), in the Runtime class, and this will execute native programs.

    So, you create a Process object, then place a wrapper Reader class around the Process's InputStream...

    eg.

    String [] cmd = {"dir", "*.jpg"};
    Process p = Runtime.getRuntime().exec(cmd);

    The cmd array holds the name of the program you wish to call (dir) and the following elements are the arguments to the called program (*.jpg).

    Then you create a DataInputStream (or any other reader that may work):

    DataInputStream d = p.getInputStream();

    That will allow you to call a native program and read its results.
    Hope this helps and that it's relevant, this site also will give you a few tips on it...

    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

    Regards


  • Registered Users Posts: 194 ✭✭pbarry


    Cheers MoonHawk,

    I have .exec() already working. It executes a batch file and takes in the input. However, Win Mobile 2003 doesn't have DOS. I downloaded pocketdos but I can't seem to get my batch file running on it!

    So I was hoping that Java had some commands that could direclty access network cards on a machine? It's a long shot.....

    Cheers


  • Registered Users Posts: 333 ✭✭s4dd


    pbarry wrote:
    Cheers MoonHawk,

    So I was hoping that Java had some commands that could direclty access network cards on a machine? It's a long shot.....

    Cheers


    No inbuilt classes preform such an action... i'd check sourceforge though.. it would suprise you the amount of low level stuffs folk impliment

    Regards


  • Registered Users Posts: 2,426 ✭✭✭ressem


    Through Java 2ME... probably not, or are you using a VM that allow JNI?

    Pocketdos ain't like a windows console, it's like dos 6.22. Have you added networking + tcp/ip stack to pocketdos?


    Otherwise, if you're willing to work for it...:
    Any chance of you downloading an building an executable using the microsoft Win Mobile 2003 SDK and C++?

    There's libraries in the SDK, in particular iphlpapi.lib which allow you to access the network card details.
    The code in http://www.codeproject.com/internet/netcfg.asp looks like it's portable to CE and demonstrates the library calls, and would allow you to get the string and similar info directly and save to text.

    Or you could build it as an exported function in a dll and call from c# or vb.net as unmanaged code. Maybe not for newbies.


  • Registered Users Posts: 194 ✭✭pbarry


    Cheers for that, I'll prob have to go down the C++ route.
    Pocketdos ain't like a windows console, it's like dos 6.22. Have you added networking + tcp/ip stack to pocketdos?

    How would I do that??


  • Advertisement
  • Moderators, Sports Moderators Posts: 8,679 Mod ✭✭✭✭Rew


    There are loads of free/shareware apps for PPC that do network stuff (like telling you your IP, Default Gateway not to mention traceroute and ping) try one of them.


  • Registered Users Posts: 194 ✭✭pbarry


    Yeah I got a few but I cant extract the info from these apps into my J2ME app. My batch file worked fine but I'm limited in terms of dos commands on a ppc.

    Plus I'll have a thread checking the default gateway every 60 sec so I dont want to have to open another program aswell as my app. I'll prob have to do an executable in C++ and run that from my app.

    I only did a small bit of C about two years ago so I'm not too pushed about using C++


  • Registered Users Posts: 2,426 ✭✭✭ressem


    How would I do that??

    With difficulty :(

    You would need some form of ndis for dos driver, that almost certainly isn't available for your hardware.

    But it explains why the console apps wouldn't work. I'd just rule pocketdos out.


Advertisement