• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to read Clients CPU information on Server

 
talha shahid
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have javaRMI Client Server programme, I want to see Cleints CPU Usage, Memory, HDD space and computer ID on Server.How can I do that can someone give me the codes for this, I really need them as this is my project work.Ok here is the RMI Client Srver programme.
/***************************************************************
* Remote Interface for the "Hello, world!" example
*****************************************************************/
import java.rmi.*;
public interface HelloInterface extends Remote {
/**
* Remotely invocable method, say().
*/
public String say() throws RemoteException;
}

/*********************************************************************
* Remote class implementation for the "Hello, world!" RMI example.
**********************************************************************/
import java.rmi.*;
import java.rmi.server.*;
public class Hello extends UnicastRemoteObject implements HelloInterface {
private String message;
/**
* Construct a remote object. msg is the message of the
* remote object, such as "Hello, world!".
*/
public Hello (String msg) throws RemoteException {
message = msg;
}
/**
* Implementation of the remotely invocable method, say().
* Returns the message of the remote object, such as "Hello, world!".
*/
public String say() throws RemoteException {
return message;
}
}
Here is our example client program, HelloClient.java:
/***************************************************************
* Client program for the "Hello, world!" RMI example.
*****************************************************************/
import java.rmi.Naming;
public class HelloClient
{
public static void main (String[] argv) {
try {
HelloInterface hello = // your PC address here
(HelloInterface) Naming.lookup ("//IP Number/Hello");
System.out.println (hello.say());
}
catch (Exception e){
System.out.println ("HelloClient exception: " + e);}
}
}
/***************************************************************
* Server program for the "Hello, world!" RMI example.
*****************************************************************/
import java.rmi.Naming;
public class HelloServer
{
public static void main (String[] argv)
{
try {
Naming.rebind ("Hello", new Hello ("Hello, world!"));
System.out.println ("Hello Server is ready.");
}
catch (Exception e) {
System.out.println ("Hello Server failed: " + e);
}
}
}
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at this thread. Pretty much the same thing, only you need to make a serializable object to contain the data and send to the server.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!