
Anhang A
116
line = communin.readLine();
if (line.equalsIgnoreCase("exit")) {
break;
}
// Eingegebener Text wird an den Server geschickt
out.write(line.getBytes());
out.write('\r');
out.write('\n');
thrd.yield();
}
// Die Verbindung mit dem Server wird beendet
System.out.println("Verbindung wird beendet! ");
thrd.anfrageStop();
thrd.yield();
try {
Thread.sleep(1000);
}
catch (InterruptedException e) { }
in.close();
out.close();
sock.close();
System.exit(1);
}
catch (IOException e) {
System.err.println(e.toString());
System.exit(1);
}
}
}
class OutputThread
extends Thread
{
InputStream in;
boolean anfrage;
public OutputThread(InputStream in)
{
this.in = in;
anfrage = false;
}
Comentarios a estos manuales