WIP2
This commit is contained in:
parent
e78d5e444c
commit
acecf4de31
1 changed files with 9 additions and 3 deletions
|
@ -174,11 +174,13 @@ class ConnectionListenerThread extends Thread {
|
||||||
{
|
{
|
||||||
response += u.getName() + " ";
|
response += u.getName() + " ";
|
||||||
}
|
}
|
||||||
|
response = response.trim();
|
||||||
response += ";";
|
response += ";";
|
||||||
for(Socket s:dest_sockets)
|
for(Socket s:dest_sockets)
|
||||||
{
|
{
|
||||||
response += s.getInetAddress().getHostAddress() + " ";
|
response += s.getInetAddress().getHostAddress() + " ";
|
||||||
}
|
}
|
||||||
|
response = response.trim();
|
||||||
System.out.println("Response :" + response);
|
System.out.println("Response :" + response);
|
||||||
responseBytes = response.getBytes();
|
responseBytes = response.getBytes();
|
||||||
responsePacket = new DatagramPacket(responseBytes, responseBytes.length, clientAddress, 1337);
|
responsePacket = new DatagramPacket(responseBytes, responseBytes.length, clientAddress, 1337);
|
||||||
|
@ -300,7 +302,8 @@ public class NetworkClient {
|
||||||
}
|
}
|
||||||
for(String a:addressList)
|
for(String a:addressList)
|
||||||
{
|
{
|
||||||
dest_sockets.add(new Socket(a, 1237+(known_users.size())));
|
System.out.println("Connecting to " + a + " on port " + (1237+usernameList.length));
|
||||||
|
dest_sockets.add(new Socket(a, 1237+usernameList.length));
|
||||||
}
|
}
|
||||||
Collections.sort(known_users);
|
Collections.sort(known_users);
|
||||||
connected = true;
|
connected = true;
|
||||||
|
@ -318,7 +321,7 @@ public class NetworkClient {
|
||||||
}
|
}
|
||||||
catch (SocketException e2)
|
catch (SocketException e2)
|
||||||
{
|
{
|
||||||
System.out.println(e2.getMessage());
|
e2.printStackTrace();
|
||||||
}
|
}
|
||||||
catch (Exception e3)
|
catch (Exception e3)
|
||||||
{
|
{
|
||||||
|
@ -337,7 +340,10 @@ public class NetworkClient {
|
||||||
{
|
{
|
||||||
dest_sockets.add(new Socket("25.67.234.235", 1237+(known_users.size())));
|
dest_sockets.add(new Socket("25.67.234.235", 1237+(known_users.size())));
|
||||||
}
|
}
|
||||||
catch(IOException e){}
|
catch(IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
user.setName(username);
|
user.setName(username);
|
||||||
known_users.add(new User(username));
|
known_users.add(new User(username));
|
||||||
|
|
Loading…
Reference in a new issue