Java RMI modify “MyClient.java”, “Method.java” and “MethodRemote.java” After your modification, re-compile, and run server and client programs, the client asks the user to enter a string. • If a string “time” is entered, the client will get current date and time from server by remotely invocating the method “action()” in server machine. • If another string other than “time” is entered, then the client will get the capitalized version of the string the user just entered by remotely invocating the method “action()” in server machine. • Your client program should keep asking the user’s input for a string unless an empty string is entered (i.e., just press ENTER key without anything else). When an empty string is entered, this client will quit.   while a client is being connected to the server, the server should be able to receive new clients’ connections for current date/time or capitalized strings. In other words, the server should concurrently handle multiple clients’ connections and requests well. And of course, after a client is closed, the server should keep running and be able to receive other clients’ connections, unless you manually shut down the server program. • Note: You do NOT need to implement multi-threads to achieve that. Java RMI has already taken care of concurrent connections. import java.rmi.*; import java.rmi.registry.*; import java.rmi.RemoteException; import java.rmi.server.*; public class MyServer{ public static void main(String args[]){ try{ MethodRemote stub = new MethodRemote(); Naming.rebind("rmi://35.39.165.77:5000/lab7", stub); //replace 35.39.165.77 with your server's IP address System.out.println("The Server is running!"); }catch(Exception e){System.out.println(e);} } }   import java.rmi.*; import java.io.*; public class MyClient{ public static void main(String args[]){ try{ Method stub=(Method)Naming.lookup("rmi://35.39.165.77:5000/lab7"); //replace 35.39.165.77 with your server's IP address System.out.println(stub.action(3,4)); }catch(Exception e){System.out.println(e);} } }   import java.rmi.*; import java.rmi.server.*; public interface Method extends Remote{ public int action(int x,int y)throws RemoteException; }   import java.rmi.*; import java.rmi.server.*; import java.util.Date; public class MethodRemote extends UnicastRemoteObject implements Method{ MethodRemote()throws RemoteException{ super(); } public int action(int x,int y){ return x+y; } }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Java RMI

modify “MyClient.java”, “Method.java” and “MethodRemote.java”

After your modification, re-compile, and run server and client programs, the client asks the user to enter a string.

• If a string “time” is entered, the client will get current date and time from server by remotely invocating the method “action()” in server machine.

• If another string other than “time” is entered, then the client will get the capitalized version of the string the user just entered by remotely invocating the method “action()” in server machine.

• Your client program should keep asking the user’s input for a string unless an empty string is entered (i.e., just press ENTER key without anything else). When an empty string is entered, this client will quit.

 

while a client is being connected to the server, the server should be able to receive new clients’ connections for current date/time or capitalized strings. In other words, the server should concurrently handle multiple clients’ connections and requests well. And of course, after a client is closed, the server should keep running and be able to receive other clients’ connections, unless you manually shut down the server program.

• Note: You do NOT need to implement multi-threads to achieve that. Java RMI has already taken care of concurrent connections.

import java.rmi.*; import java.rmi.registry.*; import java.rmi.RemoteException; import java.rmi.server.*; public class MyServer{ public static void main(String args[]){ try{ MethodRemote stub = new MethodRemote(); Naming.rebind("rmi://35.39.165.77:5000/lab7", stub); //replace 35.39.165.77 with your server's IP address System.out.println("The Server is running!"); }catch(Exception e){System.out.println(e);} } }

 

import java.rmi.*; import java.io.*; public class MyClient{ public static void main(String args[]){ try{ Method stub=(Method)Naming.lookup("rmi://35.39.165.77:5000/lab7"); //replace 35.39.165.77 with your server's IP address System.out.println(stub.action(3,4)); }catch(Exception e){System.out.println(e);} } }

 

import java.rmi.*; import java.rmi.server.*; public interface Method extends Remote{ public int action(int x,int y)throws RemoteException; }

 

import java.rmi.*; import java.rmi.server.*; import java.util.Date; public class MethodRemote extends UnicastRemoteObject implements Method{ MethodRemote()throws RemoteException{ super(); } public int action(int x,int y){ return x+y; } } 

Expert Solution
steps

Step by step

Solved in 5 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY