Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while (true) {
- try {
- if (scanner.hasNext()) {
- String message = scanner.nextLine();
- String message2 = Client.decrypt(message, key);
- ChatGUI.display(message2);
- if (message2.equals("ONLINE")) {
- ArrayList<String> online = (ArrayList<String>) obIn.readObject();
- Client.addOnlineUsers(online);
- System.out.println(online);
- public static void addOnlineUsers(ArrayList<String> online) {
- Storage.setOnlineUsers(online); //it's a simple setter
- ChatGUI.setOnline();
- public static void setOnline() {
- onlineUsers.setListData(Client.getOnlineUsers().toArray());
- }
- public void sendNewUserOnline() throws Exception{
- String notify = "ONLINE";
- for (ConnectionPair conPair : connection) {
- PrintWriter out = conPair.getWriter();
- SecretKey clientKey = conPair.getClientAesKey();
- String encMessage = encrypt(notify, clientKey);
- out.println(encMessage);
- out.flush();
- ObjectOutputStream obOut = conPair.getObOut();
- obOut.writeObject(online);
- obOut.flush();
- }
- }
- java.io.StreamCorruptedException: invalid type code: 35
- at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1374)
- at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
- at test.ClientService.run(ClientService.java:40)
- at java.lang.Thread.run(Thread.java:722)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement