|
|
@@ -24,9 +24,9 @@ public class Client extends Transmitter { |
|
|
|
|
|
|
|
private static Logger lg = Logger.getLogger("netz"); |
|
|
|
|
|
|
|
private Socket socket; |
|
|
|
private BufferedReader reader; |
|
|
|
private PrintWriter writer; |
|
|
|
// private Socket socket; |
|
|
|
// private BufferedReader reader; |
|
|
|
// private PrintWriter writer; |
|
|
|
|
|
|
|
private static final int PORT = 35000; //lt. iana port > 2¹⁵ |
|
|
|
private static final String IP = "127.0.0.1"; |
|
|
@@ -48,16 +48,6 @@ public class Client extends Transmitter { |
|
|
|
// s.close(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param args the command line arguments |
|
|
|
*/ |
|
|
|
public static void main(String[] args) { |
|
|
|
try { |
|
|
|
new Client(); |
|
|
|
} catch (IOException ex) { |
|
|
|
Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void connect() throws IOException { |
|
|
@@ -66,17 +56,17 @@ public class Client extends Transmitter { |
|
|
|
socket = new Socket(IP, PORT); |
|
|
|
lg.info("Client: Verbindung aufgebaut"); |
|
|
|
|
|
|
|
lg.info("Client: initialisiere reader und writer"); |
|
|
|
InputStream is = socket.getInputStream(); |
|
|
|
OutputStream os = socket.getOutputStream(); |
|
|
|
|
|
|
|
InputStreamReader isr = new InputStreamReader(is, "UTF-8"); |
|
|
|
OutputStreamWriter osr = new OutputStreamWriter(os, "UTF-8"); |
|
|
|
|
|
|
|
reader = new BufferedReader(isr); |
|
|
|
writer = new PrintWriter(osr); |
|
|
|
lg.info("Client: Initialisierung abgeschlossen"); |
|
|
|
|
|
|
|
// lg.info("Client: initialisiere reader und writer"); |
|
|
|
// InputStream is = socket.getInputStream(); |
|
|
|
// OutputStream os = socket.getOutputStream(); |
|
|
|
// |
|
|
|
// InputStreamReader isr = new InputStreamReader(is, "UTF-8"); |
|
|
|
// OutputStreamWriter osr = new OutputStreamWriter(os, "UTF-8"); |
|
|
|
// |
|
|
|
// reader = new BufferedReader(isr); |
|
|
|
// writer = new PrintWriter(osr); |
|
|
|
// lg.info("Client: Initialisierung abgeschlossen"); |
|
|
|
initIO(); |
|
|
|
lg.info("Client: warte auf Nachricht"); |
|
|
|
|
|
|
|
} catch (java.io.InterruptedIOException e) { |