EchoClient

Descrição

EchoClient
David Utza
Notas por David Utza, atualizado more than 1 year ago
David Utza
Criado por David Utza aproximadamente 8 anos atrás
9
0

Resumo de Recurso

Página 1

import java.io.*;import java.rmi.*;/** * Klasse EchoClient * * @version 2016-09-09 * @author David */public class EchoClient { public static final String EXIT = "exit"; public static final String PROMPT_CLIENT = "EchoClient> "; public static final String PROMPT_SERVER = "EchoServer> "; public static int uid; public static void main(String[] args) { EchoService es = null; String request = null; String response = null; boolean isRunning = false; BufferedReader in = null; while (!isRunning) { try { es = (EchoService) Naming.lookup("rmi://localhost:1099/testObject"); isRunning = true; } catch (Exception e) { // e.printStackTrace(); System.out.println("\nObjekt nicht gefunden. Programm wird beendet."); } try { Thread.sleep(2000); } catch (Exception e) { e.printStackTrace(); } } // System.exit(1); try { isRunning = true; in = new BufferedReader(new InputStreamReader(System.in)); System.out.print(PROMPT_CLIENT); request = in.readLine(); while (isRunning) { if (request != null && !request.equals(EXIT)) { uid = es.setouruid(); System.out.println(es.getc(uid)); //es.request(request); //response = es.getResponse(); System.out.println("EchoServer> " + response); System.out.print(PROMPT_CLIENT); request = in.readLine(); } else { isRunning = false; } } } catch (Exception e) { e.printStackTrace(); } }}

Semelhante

ein kleines Informatik Quiz
AntonS
Informatik
Tom Kühling
PHP Grundlagen
chrisi.0605
Wirtschaftsinformatik Teil 2
Sabrina Heckler
Informatik 1 - Einführung
Svenja
Codierung
Tom Kühling
Wirtschaftsinformatik Teil 1
Sabrina Heckler
Einführung in das Studium Informatik
Daniel Doe
Lernplan
Sandra K
Datenstrukturen
Ann-Kathrine Buchmakowsky