Avatar of jvilla1983
jvilla1983

asked on 

Is there a way to make the following code work for a Networked System?

Hi,

I'm hard at work trying to get this program to work and I'm needing some help getting this peice of code to work over the network based on an IP address.

So instead of the method name with no arguments, it woud have String IP_ADDR..

Any help would be appriciated,
Thanks in advance!

public static String getCPUName() {
    try {
      Process process = Runtime.getRuntime().exec(CPU_NAME_CMD);
      StreamReader reader = new StreamReader(process.getInputStream());
 
      reader.start();
      process.waitFor();
      reader.join();
 
      String result = reader.getResult();
      int p = result.indexOf(REGSTR_TOKEN);
 
      if (p == -1)
         return null;
 
      return result.substring(p + REGSTR_TOKEN.length()).trim();
    }
    catch (Exception e) {
      return null;
    }
  }

Open in new window

Java

Avatar of undefined
Last Comment
jvilla1983
Avatar of bluebelldiscovery
bluebelldiscovery
Flag of Singapore image

Are u trying to extract some text from a return command?

If so what is the command you need to send & a sample of the return output?
Avatar of jvilla1983
jvilla1983

ASKER

I would be sending a String IP address. This would return string information into a computer object.
ASKER CERTIFIED SOLUTION
Avatar of bluebelldiscovery
bluebelldiscovery
Flag of Singapore image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of jvilla1983
jvilla1983

ASKER

Thanks for the help!
Java
Java

Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.

102K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo