|
@ -20,7 +20,7 @@ public class ChatClient extends JFrame implements KeyListener { |
|
|
super("Chat"); |
|
|
super("Chat"); |
|
|
address = JOptionPane.showInputDialog("bitte IP-Adresse"); |
|
|
address = JOptionPane.showInputDialog("bitte IP-Adresse"); |
|
|
|
|
|
|
|
|
if (address != null) { |
|
|
|
|
|
|
|
|
if (null != address) { |
|
|
receiveMessages(); |
|
|
receiveMessages(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -47,8 +47,8 @@ public class ChatClient extends JFrame implements KeyListener { |
|
|
private void receiveMessages() { |
|
|
private void receiveMessages() { |
|
|
try { |
|
|
try { |
|
|
connectionToServer = new Socket(address, Constants.PORT); |
|
|
connectionToServer = new Socket(address, Constants.PORT); |
|
|
fromServerReader = new BufferedReader(new InputStreamReader(connectionToServer.getInputStream())); |
|
|
|
|
|
toServerWriter = new PrintWriter(new OutputStreamWriter(connectionToServer.getOutputStream())); |
|
|
|
|
|
|
|
|
fromServerReader = new BufferedReader(new InputStreamReader(connectionToServer.getInputStream())); |
|
|
|
|
|
toServerWriter = new PrintWriter(new OutputStreamWriter(connectionToServer.getOutputStream())); |
|
|
|
|
|
|
|
|
initGui(); |
|
|
initGui(); |
|
|
|
|
|
|
|
|