Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //***************************************
- // Verteilte Systeme Praktikum 7
- // 03.12.11 mteppner, vkoschmann
- // News Client
- //***************************************
- import java.net.MalformedURLException;
- import java.rmi.Naming;
- import java.rmi.RemoteException;
- import java.rmi.NotBoundException;
- import java.rmi.*;
- import java.io.*;
- public class Client {
- /**
- * @param args
- * @throws IOException
- */
- public static void main(String[] args) throws IOException {
- try {
- NewsServer ns = (NewsServer) Naming.lookup("rmi://localhost:1099/NewsServerService");
- System.out.println("Login, Bitte nickname eingeben --> ");
- InputStreamReader isr = new InputStreamReader(System.in);
- BufferedReader br = new BufferedReader(isr);
- String name = br.readLine();
- ns.login(name);
- while(true){
- System.out.println();
- System.out.println("NewsClient-Menue");
- System.out.println("======================");
- System.out.println("(1) Neue News anzeigen");
- System.out.println("(2) Neue News erstellen");
- System.out.println("(0) Beenden");
- System.out.println();
- System.out.println("--> ");
- String choice = br.readLine();
- int c = Integer.parseInt(choice);
- if(c == 1){
- //showNew
- }
- else if(c == 2){
- //create
- }
- else if(c == 0){
- System.out.println("Programm wird beendet");
- break;
- }
- else{
- System.out.println("Ungueltige Eingabe");
- }
- }
- } catch (RemoteException re) {
- System.out.println();
- System.out.println("RemoteException");
- System.out.println(re);
- } catch (NotBoundException nbe) {
- System.out.println();
- System.out.println("NotBoundException");
- System.out.println(nbe);
- }catch(java.lang.ArithmeticException ae) {
- System.out.println();
- System.out.println("java.lang.ArithmeticException");
- System.out.println(ae);
- }
- }
- }
Add Comment
Please, Sign In to add comment