forked from AdvancedProgramming1404/HW-10-Socket-Programming
socket_programing
This commit is contained in:
@@ -29,10 +29,8 @@ public class ServerListener implements Runnable{
|
|||||||
} else {
|
} else {
|
||||||
System.out.println(chat.getSender() + ": " + chat.getContent());
|
System.out.println(chat.getSender() + ": " + chat.getContent());
|
||||||
}
|
}
|
||||||
System.out.print("> ");
|
|
||||||
}else if(msg instanceof FileMessage file){
|
}else if(msg instanceof FileMessage file){
|
||||||
System.out.println("File received: " + file.getFilename() + " from " + file.getSender());
|
System.out.println("File received: " + file.getFilename() + " from " + file.getSender());
|
||||||
System.out.print("> ");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class chatClient {
|
|||||||
listenerThread.setDaemon(true);
|
listenerThread.setDaemon(true);
|
||||||
listenerThread.start();
|
listenerThread.start();
|
||||||
|
|
||||||
out.writeObject(new ChatMessage(MessageType.LOGIN, username, null, "Login request"));
|
out.writeObject(new ChatMessage(MessageType.LOGIN, username, null, username));
|
||||||
out.flush();
|
out.flush();
|
||||||
|
|
||||||
Thread.sleep(300);
|
Thread.sleep(300);
|
||||||
|
|||||||
Reference in New Issue
Block a user