Browse Source

variablen in abstrakter klasse nicht private

Toni
ahren 1 year ago
parent
commit
96ac335267
1 changed files with 14 additions and 24 deletions
  1. 14
    24
      src/ChatProgramm/model/Client.java

+ 14
- 24
src/ChatProgramm/model/Client.java View File



private static Logger lg = Logger.getLogger("netz"); 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 int PORT = 35000; //lt. iana port > 2¹⁵
private static final String IP = "127.0.0.1"; private static final String IP = "127.0.0.1";
// s.close(); // 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 @Override
public void connect() throws IOException { public void connect() throws IOException {
socket = new Socket(IP, PORT); socket = new Socket(IP, PORT);
lg.info("Client: Verbindung aufgebaut"); 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"); lg.info("Client: warte auf Nachricht");


} catch (java.io.InterruptedIOException e) { } catch (java.io.InterruptedIOException e) {

Loading…
Cancel
Save