|
|
|
|
@ -67,7 +67,9 @@ public class NetworkInterface {
|
|
|
|
|
HostedGamesRequestEncoder encoder = new HostedGamesRequestEncoder();
|
|
|
|
|
try {
|
|
|
|
|
byte[] message = encoder.encode(new HostGamesRequest(games));
|
|
|
|
|
System.out.println(LocalDateTime.now() + ": Sending " + games.size() + " game/s");
|
|
|
|
|
for(ClientAddress address: clientsAddresses) {
|
|
|
|
|
System.out.println("Sending to " + address.getIp());
|
|
|
|
|
serverSocket.send(new DatagramPacket(message, message.length, InetAddress.getByName(address.getIp()), 4941));
|
|
|
|
|
}
|
|
|
|
|
} catch (InvalidMessageException | IOException e) {
|
|
|
|
|
@ -85,6 +87,7 @@ public class NetworkInterface {
|
|
|
|
|
scheduler.scheduleAtFixedRate(new TimerTask() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
System.out.println("flush");
|
|
|
|
|
matchTable.getMatchTable().clear();
|
|
|
|
|
}
|
|
|
|
|
}, period, period);
|
|
|
|
|
|