Showing posts with label Methods. Show all posts
Showing posts with label Methods. Show all posts

Latest Remote Method Invocation Simple Program(RMI) For Carrier 2010 2011

Latest Remote Method Invocation Simple Program(RMI) For Carrier 2010 2011

File Interfave.java:
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface FileInterface extends Remote {
public byte[] downloadFile(String fileName) throws
RemoteException; }


FileImpl.java:
import java.io.*;
import java.rmi.*;
import java.rmi.server.UnicastRemoteObject;
public class FileImpl extends UnicastRemoteObject
implements FileInterface {
private String name;
public FileImpl(String s) throws RemoteException{
super();
name = s; }
public byte[] downloadFile(String fileName){
try {
File file = new File(fileName);
byte buffer[] = new byte[(int)file.length()];
BufferedInputStream input = new
BufferedInputStream(new FileInputStream(fileName));
input.read(buffer,0,buffer.length);
input.close();
return(buffer);
} catch(Exception e){
System.out.println("FileImpl: "+e.getMessage());
e.printStackTrace();
return(null);
} }}


FileClient.java:

import java.io.*;import java.rmi.*;
public class FileClient{
public static void main(String argv[]) {
if(argv.length != 2) {
System.out.println("Usage: java FileClient fileName machineName");
System.exit(0);
}
try {
String name = "//" + argv[1] + "/FileServer";
FileInterface fi = (FileInterface) Naming.lookup(name);
byte[] filedata = fi.downloadFile(argv[0]);
File file = new File(argv[0]);
BufferedOutputStream output = new
BufferedOutputStream(new FileOutputStream(file.getName()));
output.write(filedata,0,filedata.length);
output.flush();
output.close();
} catch(Exception e) {
System.err.println("FileServer exception: "+ e.getMessage());
e.printStackTrace();
} }}


FileServer.java:
import java.io.*;
import java.rmi.*;
public class FileServer {
public static void main(String argv[]) {
if(System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}
try {
FileInterface fi = new FileImpl("FileServer");
Naming.rebind("//127.0.0.1/FileServer", fi);
} catch(Exception e) {
System.out.println("FileServer: "+e.getMessage());
e.printStackTrace();
} }}


Policy.txt:
grant {
permission java.security.AllPermission "", "";
};


Running steps :
Z:\rmiex>javac FileInterface.java
Z:\rmiex>javac FileImpl.java
Z:\rmiex>javac FileServer.java
Z:\rmiex>javac FileClient.java
Z:\rmiex>rmic FileImpl
Z:\rmiex>start rmiregistry
Z:\rmiex>java -Djava.security.policy=policy.txt FileServer
Z:\rmiex>java FileClient fileName machineName
exp: java FileClient z:\calci.docx ittft27


Latest Remote Method Invocation Simple Program(RMI) For Carrier 2010 2011

Latest Hashing Methods 2010 2011

Here is the  Hashing Methods And Tutorials Guide.It is the 2011 year Basic Steps For Hashing Methods . It also has previous year Hashing Methods  2010. Here are old and new Hashing Methods  and also.It also has sample,frequently asked (FAQ) and  Hashing Methods .It also has the Important Concept.so don't miss these file.if you really interest to download that file means view the latest  Hashing Methods from below link.

Latest Queue Types and Methods 2011

The Following Queue Types and Methods are very simple and effective. It also has important and best Queue Types and Methods for beginner. The Queue Types and Methods  explained each and every terms are more conceptullay and experimentally. To Download these file from below link.

Latest Hasing Methods in C and Algorithms 2010 2011

Here is the  Hasing Methods in C and Algorithms And Tutorials Guide.It is the 2011 year Basic Steps For Hasing Methods in C and Algorithms . It also has previous year Hasing Methods in C and Algorithms  2010. Here are old and new Hasing Methods in C and Algorithms  and also.It also has sample,frequently asked (FAQ) and  Hasing Methods in C and Algorithms .It also has the Important Concept.so don't miss these file.if you really interest to download that file means view the latest  Hasing Methods in C and Algorithms from below link.

Latest Hashing Algorithm Methods 2010 2011

Here is the Hashing Algorithm Methods And Tutorials Guide.It is the 2011 year Basic Steps For Hashing Algorithm Methods . It also has previous year Hashing Algorithm Methods  2010. Here are old and new Hashing Algorithm Methods  and also.It also has sample,frequently asked (FAQ) and Hashing Algorithm Methods .It also has the Important Concept.so don't miss these file.if you really interest to download that file means view the latest Hashing Algorithm Methods from below link.

Latest List Methods and Tutorials 2010 2011

Here is the List Methods and Tutorials And Tutorials Guide.It is the 2011 year Basic Steps ForList Methods and Tutorials . It also has previous yearList Methods and Tutorials  2010. Here are old and newList Methods and Tutorials  and also.It also has sample,frequently asked (FAQ) andList Methods and Tutorials .It also has the Important Concept.so don't miss these file.if you really interest to download that file means view the latestList Methods and Tutorials from below link.

Word Star Training Methods and Information 2011

This Word Star Learning Information having the best and important informations related to the interview questions and the General Questions. If you read this Word Star Learning Information, you will definitely tune your General Knowledge. This Word Star Learning Information also helps to sharp the General informations to students also. For those peoples, This Word Star Learning Information will be useful and helpful one. If you want to see those interested questions can download the below link.

Privacy Policy

All the Colleges, Schools, Universities, Top lists, Interview question paper, Programming, Tips, Tutorials and all other's just information purpose only. We are not responsible for any damages caused to you.