diff --git a/src/chat/ClientWindow.java b/src/chat/ClientWindow.java index ee9072e..58d07c9 100644 --- a/src/chat/ClientWindow.java +++ b/src/chat/ClientWindow.java @@ -139,8 +139,9 @@ class ConnectionListenerThread extends Thread { response2 = bStream.toByteArray(); responsePacket2 = new DatagramPacket(response2, response2.length, clientAddress, 1338); responseSocket.send(responsePacket2); + if(!user.findUser(username)) - user.add_to_known_users(username, clientAddress.toString()); + user.add_to_known_users(username, clientAddress.getHostAddress()); } catch(SocketTimeoutException e) @@ -227,7 +228,7 @@ public class ClientWindow implements ActionListener { userList = (ArrayList) userListStream.readObject(); hostList = (ArrayList) hostListStream.readObject(); - System.out.println(userList.size() + "users currently connected"); + System.out.println(userList.size() + " users currently connected"); if (userList.indexOf(username) != -1) connected = false; @@ -236,8 +237,8 @@ public class ClientWindow implements ActionListener { user.add_to_known_users(username, InetAddress.getLocalHost().getHostAddress()); for(int i = 0;i < userList.size();i ++) { - System.out.println(userList.get(i)); - System.out.println(hostList.get(i)); + System.out.println("Name:" + userList.get(i)); + System.out.println("Address:" + hostList.get(i)); user.add_to_known_users(userList.get(i), hostList.get(i)); } connected = true;