-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathClient.java
More file actions
36 lines (35 loc) · 1.16 KB
/
Client.java
File metadata and controls
36 lines (35 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.*;
public class Client {
private Client() {}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String result = "";
try {
// Getting the registry
Registry registry = LocateRegistry.getRegistry(null);
// Looking up the registry for the remote object
UtilsServer stub = (UtilsServer) registry.lookup("Dream11-master");
String str;
while(sc.hasNext()){
try{
str = sc.nextLine();
// System.out.print("You have entered: "+str + "\n");
result = stub.Query(str);
System.out.println(result);
if (str.equals("exit")) {
System.exit(0);
}
}
catch(Exception e){
System.out.println(e);
break;
}
}
} catch (Exception e) {
System.err.println("Client exception: " + e.toString());
e.printStackTrace();
}
}
}