Please help: Get IP address of a remote device (wifi kit) from DHCP router

Hi ppl,
I am about to get the IP address for the wifi kit which is connected to the same router with my PC.
I need to control my wifi kit through TCP client communication, but DHCP tends to assign new IP address to my wifi kit when connected to router.
Hence, i wish to write a java function to trace the IP address before starts the communication.
I am thinking to get the wifi kit's IP address based on the Hostname (name of the wifi shield):
As below:
InetAddress thatIp = InetAddress.getByName("Wiznet");
System.out.println("IP E:"+thatIp.getHostAddress());
But i don't think this is secure..
I attempt to research for getting IP address with MAC..
But have ambiguity on the result i found.
It stating i have to get the ARP table from router but it is not a good approach.
I have no luck for next finding on how retrieving the table with Java.
Hereby hope to have your advise how can i get the ip address of my wifi kit in a more dynamic and secure method..
is it using Hostname or MAC address or else...
many thanks.

hi... wish to have your advise again.
I tried to retrieve the arp table in java and attempt to extract the IP address based on MAC address for particular devise.
But i stuck with the substring... my code is as below:
Process result = Runtime.getRuntime().exec("arp -a");
     BufferedReader output = new BufferedReader
               (new InputStreamReader(result.getInputStream()));
     String line = output.readLine();
     while(line != null){
          if ( line.startsWith("default") == true ){
               System.out.println("is default");
               break;
     line = output.readLine();
     String ipAdd = line.substring(0, 18);
     String MACAdd = line.substring(24, 42);
     System.out.println(line.length() + " " + line + " " + ipAdd + " " + MACAdd );
i m trying to sub the IP and MAC accordingly.. but i got error saying
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 42
     at java.lang.String.substring(Unknown Source)
     at ExecTest.main(ExecTest.java:22)
i dun understand this! as since the length of LINE is 56 , why STRING INDEX OUT OF RANGE happen?!
please advise!!!

Similar Messages

Maybe you are looking for

  • Socket lost data

    We have a socket connection and when reading a huge XML file, part of it is lost. No exceptions are thrown. only a few lines in the middle of the xml is lost. We use InputStream in = socket.getInputStream(); BufferedReader dis = new BufferedReader(ne

  • MS OFFICE 2008

    I recently bought MS Office 2008 for my dell and now just bought the MB Pro. Are there other "substitutes" on Mac OSX that would take the place of Office? I think I can order the MAC version and install it on my MB Thanks

  • Macbook Pro 13 Warranty

    I am about to buy a Macbook Pro 13, should I go for and do I need the extra 3 years warranty?

  • Failed to resolve JCO destination name 'WD_SO_INTERNAL_RFC_METADATA_DEST' i

    Hi  All, In the webdynpro content administrator. All the 'create ,the other links like 'test', 'preview','edit','ping','remove' are all disabled. when i am trying to access the webdynpro application i am getting the following error. can any body tell

  • Exceptions during startup of WLCS 3.5

    Hi, I just downloaded and installed WLCS 3.5. I'm trying to run it with WebLogic 6.0sp1. I get the following errors when the server starts up, although I can still request pages and the administration tools and exampleportal seem to work fine. I've a