up
This commit is contained in:
parent
5512f1a358
commit
216ef81855
21 changed files with 2201 additions and 2725 deletions
|
|
@ -91,6 +91,7 @@ public class Game {
|
|||
//Invia tcp req a server per dirgli che sto joinando
|
||||
DefaultListModel<String> matchNames = new DefaultListModel<String>();
|
||||
matchNames.addElement(matchName);
|
||||
System.out.println("STO JOINANDO");
|
||||
Message message = new Message("JOIN_GAME", App.session.account.userName, App.session.token, matchNames);
|
||||
|
||||
byte[] byteMessage = new String(message.toString()).getBytes();
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class SendWords extends SwingWorker<Void,Void> {
|
|||
|
||||
@Override
|
||||
public void done(){
|
||||
System.out.println("Done");
|
||||
System.out.println("Done send SCOREEEEEE");
|
||||
try {
|
||||
this.callback.execute();
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -74,10 +74,12 @@ public class WaitForPlayers extends SwingWorker<DefaultListModel<String>,Default
|
|||
App.game.setMulticastId(multicastId);
|
||||
|
||||
App.game.multicastSocket = new MulticastSocket(App.game.multicastId);
|
||||
System.out.println(App.game.multicastSocket);
|
||||
InetAddress ia = InetAddress.getByName(Config.ScoreMulticastServerURI);
|
||||
App.game.multicastSocket.joinGroup(ia);
|
||||
letters = msg.data;
|
||||
|
||||
|
||||
//socketChannel.close();
|
||||
return words;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,8 +33,12 @@ public class WaitForScore extends SwingWorker<Void,Void> {
|
|||
|
||||
|
||||
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);
|
||||
|
|
@ -47,9 +51,15 @@ public class WaitForScore extends SwingWorker<Void,Void> {
|
|||
}
|
||||
}
|
||||
App.game.ranks = ranks;
|
||||
App.game.multicastSocket.leaveGroup(InetAddress.getByName(Config.ScoreMulticastServerURI));
|
||||
|
||||
System.out.println(App.game.ranks);
|
||||
System.out.println("ENDDDDd");
|
||||
|
||||
App.game.multicastSocket.disconnect();
|
||||
App.game.multicastSocket.close();
|
||||
|
||||
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
|
|
@ -62,7 +72,7 @@ public class WaitForScore extends SwingWorker<Void,Void> {
|
|||
public void done(){
|
||||
System.out.println("Done ranks");
|
||||
App.game.ranks = ranks;
|
||||
App.game.multicastSocket.close();
|
||||
// App.game.multicastSocket.close();
|
||||
//App.game.clientSocket.close();
|
||||
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue