├── Stringr.class ├── AddClient.class ├── AddServer.class ├── StringImpl.class ├── Stringr.java ├── AddServer.java ├── StringImpl.java └── AddClient.java /Stringr.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Suraja18/Reverse_String/HEAD/Stringr.class -------------------------------------------------------------------------------- /AddClient.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Suraja18/Reverse_String/HEAD/AddClient.class -------------------------------------------------------------------------------- /AddServer.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Suraja18/Reverse_String/HEAD/AddServer.class -------------------------------------------------------------------------------- /StringImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Suraja18/Reverse_String/HEAD/StringImpl.class -------------------------------------------------------------------------------- /Stringr.java: -------------------------------------------------------------------------------- 1 | //Defining the remote interface 2 | import java.rmi.*; 3 | public interface Stringr extends Remote { 4 | public String ReverseString (String ch) throws RemoteException; 5 | } 6 | 7 | -------------------------------------------------------------------------------- /AddServer.java: -------------------------------------------------------------------------------- 1 | //Server Program 2 | import java.rmi.*; 3 | import java.net.*; 4 | 5 | public class AddServer { 6 | public static void main(String[] args){ 7 | try{ 8 | StringImpl obj = new StringImpl(); 9 | Naming.rebind("rmi:///Stringr",obj); 10 | } catch (MalformedURLException | RemoteException e) { 11 | e.printStackTrace(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /StringImpl.java: -------------------------------------------------------------------------------- 1 | //implementing interface 2 | import java.rmi.*; 3 | import java.rmi.server.*; 4 | import java.util.*; 5 | public class StringImpl extends UnicastRemoteObject implements Stringr { 6 | public StringImpl() throws RemoteException{} 7 | public String ReverseString(String ch){ 8 | int i= 0; 9 | String blank = ""; 10 | for(i =ch.length()-1; i>=0; i--){ 11 | blank = blank+ch.charAt(i); 12 | } 13 | 14 | return (blank); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /AddClient.java: -------------------------------------------------------------------------------- 1 | //Client Program 2 | import java.rmi.*; 3 | import java.net.*; 4 | import java.io.*; 5 | import java.util.*; 6 | 7 | public class AddClient { 8 | public static void main(String[] args) throws IOException { 9 | String host = "localhost"; 10 | BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); 11 | System.out.println("Enter any String: "); 12 | String input = reader.readLine(); 13 | try{ 14 | Stringr obj = (Stringr)Naming.lookup("rmi://"+host+"/Stringr"); 15 | System.out.println(obj.ReverseString(input)); 16 | } catch (MalformedURLException | NotBoundException | RemoteException e) { 17 | e.printStackTrace(); 18 | } 19 | 20 | } 21 | } 22 | --------------------------------------------------------------------------------