feat: print newly connected user

This commit is contained in:
Arnaud Vergnet 2020-12-07 15:44:59 +01:00
parent 6ef37e2d72
commit 272ccd2914

View file

@ -48,10 +48,9 @@ public class MainApp extends Application {
(ipAddr, data) -> System.out.println("User detected at address : " + ipAddr.toString() + " with name " + data),
Throwable::printStackTrace);
// TCP communnication tests
// TCP communication tests
connectionListener = new ConnectionListener();
connectionListener.acceptConnection(user -> {
}, e -> {
connectionListener.acceptConnection(user -> System.out.println("New connection request : " + user.getUsername()), e -> {
if (e instanceof java.io.EOFException) {
System.out.println("Connexion terminée");
} else {
@ -59,7 +58,7 @@ public class MainApp extends Application {
}
});
ActiveUser.create(InetAddress.getLocalHost(), user -> {
ActiveUser.create(InetAddress.getByName("192.168.43.14"), user -> {
System.out.println("Connexion établie !");
user.destroy();
},