diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 5c89faf..d5dd14d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,25 +5,8 @@ - - - - - - - - - - - - - - - - - @@ -46,27 +29,25 @@ - - + + - - + + - - + - - + + - - + + - - + @@ -75,88 +56,15 @@ - - + + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -255,13 +163,13 @@ @@ -621,110 +529,6 @@ - - - - - - + + @@ -841,8 +641,12 @@ - - + + + + + + @@ -1332,7 +1136,7 @@ - @@ -1341,12 +1145,13 @@ + - + @@ -1354,20 +1159,43 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + @@ -1387,22 +1215,10 @@ - - - - - - - - - - - - @@ -1424,7 +1240,6 @@ - @@ -1432,7 +1247,6 @@ - @@ -1464,7 +1278,6 @@ - @@ -1479,7 +1292,6 @@ - @@ -1506,7 +1318,6 @@ - @@ -1528,7 +1339,6 @@ - @@ -1536,7 +1346,6 @@ - @@ -1544,7 +1353,6 @@ - @@ -1568,7 +1376,6 @@ - @@ -1584,7 +1391,6 @@ - @@ -1600,7 +1406,6 @@ - @@ -1632,7 +1437,6 @@ - @@ -1664,7 +1468,6 @@ - @@ -1676,38 +1479,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1719,41 +1494,21 @@ - - - - - - - - - - - + + - - - - - - - - - - - @@ -1773,16 +1528,6 @@ - - - - - - - - - - @@ -1806,7 +1551,6 @@ - @@ -1814,10 +1558,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Client/src/com/texttwist/client/tasks/WaitForScore.java b/Client/src/com/texttwist/client/tasks/WaitForScore.java index 2e3dae7..9d3ab50 100644 --- a/Client/src/com/texttwist/client/tasks/WaitForScore.java +++ b/Client/src/com/texttwist/client/tasks/WaitForScore.java @@ -31,18 +31,23 @@ public class WaitForScore extends SwingWorker { InetAddress group = null; try { + Message msg; + while(true) { + byte[] buf = new byte[1024]; + System.out.println("SONO QUIIIII"); + DatagramPacket recv = new DatagramPacket(buf, buf.length); + System.out.println("ANCORA QUII"); + App.game.multicastSocket.receive(recv); - byte[] buf = new byte[1024]; - System.out.println("SONO QUIIIII"); - DatagramPacket recv = new DatagramPacket(buf, buf.length); - System.out.println("ANCORA QUII"); - App.game.multicastSocket.receive(recv); - System.out.println("SEMPRE QUII"); + String s = new String(recv.getData()); + System.out.println("HSHSHSHS"); + System.out.println(s); + msg = Message.toMessage(s); + if(msg.message.equals("ASD")){ + break; + } + } - String s = new String(recv.getData()); - System.out.println("HSHSHSHS"); - System.out.println(s); - Message msg = Message.toMessage(s); if(msg.data != null) { for (int i = 0; i < msg.data.size() - 1; i++) { String[] splitted = msg.data.get(i).split(":"); diff --git a/Server/src/com/texttwist/server/components/ThreadProxy.java b/Server/src/com/texttwist/server/components/ThreadProxy.java index 990041a..d83dfdc 100644 --- a/Server/src/com/texttwist/server/components/ThreadProxy.java +++ b/Server/src/com/texttwist/server/components/ThreadProxy.java @@ -179,21 +179,23 @@ public class ThreadProxy implements Callable { //match.setUndefinedScorePlayersToZero(); - Message msg = new Message("FINALSCORE","SERVER","", match.getMatchPlayersScoreAsStringList()); + while(true) { + Message msg = new Message("FINALSCORE", "SERVER", "", match.getMatchPlayersScoreAsStringList()); - MulticastSocket multicastSocket = new MulticastSocket(match.multicastId); - System.out.println(multicastSocket); - System.out.println(match.multicastId); - InetAddress ia = InetAddress.getByName(Config.ScoreMulticastServerURI); - DatagramPacket hi = new DatagramPacket(msg.toString().getBytes(), msg.toString().length(), ia, match.multicastId); - System.out.println(msg.toString()); - multicastSocket.send(hi); - activeMatches.remove(Match.findMatchIndex(activeMatches, match.matchCreator)); - multicastSocket.disconnect(); - multicastSocket.close(); + MulticastSocket multicastSocket = new MulticastSocket(match.multicastId); + System.out.println(multicastSocket); + System.out.println(match.multicastId); + InetAddress ia = InetAddress.getByName(Config.ScoreMulticastServerURI); + DatagramPacket hi = new DatagramPacket(msg.toString().getBytes(), msg.toString().length(), ia, match.multicastId); + System.out.println(msg.toString()); + multicastSocket.send(hi); + activeMatches.remove(Match.findMatchIndex(activeMatches, match.matchCreator)); + //multicastSocket.disconnect(); + //multicastSocket.close(); + } //RISPONDI CON LA CLASSIFICA - break; + // break; //ULTIMO A JOINARE! INIZIA GIOCO } else { System.out.print("WAIT FRIENDS"); diff --git a/client_1.log b/client_1.log index 9ddab72..38223ed 100644 --- a/client_1.log +++ b/client_1.log @@ -4316,3 +4316,18 @@ LOGGER (Client1): Thu Jul 06 18:57:18 CEST 2017 - Invoked invitation with userna LOGGER (Client1): Thu Jul 06 18:57:32 CEST 2017 - Invoked invitation with username=a|[b] LOGGER (Client1): Thu Jul 06 18:57:32 CEST 2017 - Invoked invitation with username=a|[b] LOGGER (Client1): Thu Jul 06 18:57:32 CEST 2017 - a ti ha sfidato! +LOGGER (Client1): Thu Jul 06 23:00:12 CEST 2017 - Client starting ... +LOGGER (Client1): Thu Jul 06 23:00:14 CEST 2017 - Client starting ... +LOGGER (Client1): Thu Jul 06 23:00:22 CEST 2017 - Invoked invitation with username=b|[a] +LOGGER (Client1): Thu Jul 06 23:00:22 CEST 2017 - Invoked invitation with username=b|[a] +LOGGER (Client1): Thu Jul 06 23:00:22 CEST 2017 - b ti ha sfidato! +LOGGER (Client1): Thu Jul 06 23:02:14 CEST 2017 - Client starting ... +LOGGER (Client1): Thu Jul 06 23:02:15 CEST 2017 - Client starting ... +LOGGER (Client1): Thu Jul 06 23:02:22 CEST 2017 - Invoked invitation with username=b|[a] +LOGGER (Client1): Thu Jul 06 23:02:22 CEST 2017 - Invoked invitation with username=b|[a] +LOGGER (Client1): Thu Jul 06 23:02:22 CEST 2017 - b ti ha sfidato! +LOGGER (Client1): Thu Jul 06 23:06:00 CEST 2017 - Client starting ... +LOGGER (Client1): Thu Jul 06 23:06:09 CEST 2017 - Client starting ... +LOGGER (Client1): Thu Jul 06 23:06:15 CEST 2017 - Invoked invitation with username=b|[a] +LOGGER (Client1): Thu Jul 06 23:06:15 CEST 2017 - b ti ha sfidato! +LOGGER (Client1): Thu Jul 06 23:06:15 CEST 2017 - Invoked invitation with username=b|[a] diff --git a/server.log b/server.log index 12fa964..af4b15b 100644 --- a/server.log +++ b/server.log @@ -6453,3 +6453,27 @@ LOGGER (Server): Thu Jul 06 18:57:12 CEST 2017 - Invoked login with username=a A LOGGER (Server): Thu Jul 06 18:57:12 CEST 2017 - Login successfull LOGGER (Server): Thu Jul 06 18:57:16 CEST 2017 - Invoked login with username=b AND password=b LOGGER (Server): Thu Jul 06 18:57:16 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 06 23:00:10 CEST 2017 - Server starting ... +LOGGER (Server): Thu Jul 06 23:00:10 CEST 2017 - Auth Service running at 9999 port... +LOGGER (Server): Thu Jul 06 23:00:10 CEST 2017 - Server started +LOGGER (Server): Thu Jul 06 23:00:10 CEST 2017 - GamePage Service is running at 10000 port... +LOGGER (Server): Thu Jul 06 23:00:16 CEST 2017 - Invoked login with username=a AND password=a +LOGGER (Server): Thu Jul 06 23:00:16 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 06 23:00:19 CEST 2017 - Invoked login with username=b AND password=b +LOGGER (Server): Thu Jul 06 23:00:19 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 06 23:02:12 CEST 2017 - Server starting ... +LOGGER (Server): Thu Jul 06 23:02:12 CEST 2017 - Auth Service running at 9999 port... +LOGGER (Server): Thu Jul 06 23:02:12 CEST 2017 - Server started +LOGGER (Server): Thu Jul 06 23:02:12 CEST 2017 - GamePage Service is running at 10000 port... +LOGGER (Server): Thu Jul 06 23:02:16 CEST 2017 - Invoked login with username=a AND password=a +LOGGER (Server): Thu Jul 06 23:02:16 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 06 23:02:18 CEST 2017 - Invoked login with username=b AND password=b +LOGGER (Server): Thu Jul 06 23:02:18 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 06 23:05:58 CEST 2017 - Server starting ... +LOGGER (Server): Thu Jul 06 23:05:58 CEST 2017 - Auth Service running at 9999 port... +LOGGER (Server): Thu Jul 06 23:05:58 CEST 2017 - Server started +LOGGER (Server): Thu Jul 06 23:05:58 CEST 2017 - GamePage Service is running at 10000 port... +LOGGER (Server): Thu Jul 06 23:06:03 CEST 2017 - Invoked login with username=a AND password=a +LOGGER (Server): Thu Jul 06 23:06:03 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 06 23:06:11 CEST 2017 - Invoked login with username=b AND password=b +LOGGER (Server): Thu Jul 06 23:06:11 CEST 2017 - Login successfull