From 7665c8343e0a8c470165d1fcf3cca6f330e415f8 Mon Sep 17 00:00:00 2001 From: Imanol-Mikel Barba Sabariego Date: Tue, 10 Dec 2013 03:19:39 +0000 Subject: [PATCH] git-svn-id: svn://imanolbarba.net/PAD@31 c2ee353e-ed0d-4329-bf56-03aec153487f --- JChatServer/bin/pad/prac2/Connection.class | Bin 3723 -> 0 bytes JChatServer/bin/pad/prac2/JChat.class | Bin 866 -> 0 bytes JChatServer/bin/pad/prac2/MySocket.class | Bin 3208 -> 0 bytes JChatServer/src/pad/prac2/Connection.java | 2 ++ JChatServer/src/pad/prac2/JChat.java | 4 ++-- JChatServer/src/pad/prac2/MySocket.java | 2 +- 6 files changed, 5 insertions(+), 3 deletions(-) diff --git a/JChatServer/bin/pad/prac2/Connection.class b/JChatServer/bin/pad/prac2/Connection.class index 91aeb10..891b892 100644 Binary files a/JChatServer/bin/pad/prac2/Connection.class and b/JChatServer/bin/pad/prac2/Connection.class differ diff --git a/JChatServer/bin/pad/prac2/JChat.class b/JChatServer/bin/pad/prac2/JChat.class index 4eb79da..0906afc 100644 Binary files a/JChatServer/bin/pad/prac2/JChat.class and b/JChatServer/bin/pad/prac2/JChat.class differ diff --git a/JChatServer/bin/pad/prac2/MySocket.class b/JChatServer/bin/pad/prac2/MySocket.class index d646e02..ea93697 100644 Binary files a/JChatServer/bin/pad/prac2/MySocket.class and b/JChatServer/bin/pad/prac2/MySocket.class differ diff --git a/JChatServer/src/pad/prac2/Connection.java b/JChatServer/src/pad/prac2/Connection.java index 757e66a..5002a5d 100644 --- a/JChatServer/src/pad/prac2/Connection.java +++ b/JChatServer/src/pad/prac2/Connection.java @@ -134,6 +134,7 @@ public class Connection extends Thread } else if(str.equals("")) { + System.out.println(serv.getNickname(this) + " disconnected"); break; } else @@ -145,6 +146,7 @@ public class Connection extends Thread catch(IOException ioExc) { System.out.println("TCP: Error writing to socket"); + System.out.println(serv.getNickname(this) + " disconnected"); break; } } diff --git a/JChatServer/src/pad/prac2/JChat.java b/JChatServer/src/pad/prac2/JChat.java index 1e794d2..cb9311a 100644 --- a/JChatServer/src/pad/prac2/JChat.java +++ b/JChatServer/src/pad/prac2/JChat.java @@ -9,14 +9,14 @@ public class JChat String ip; int port, roomSize; - /*Scanner in = new Scanner(System.in); + Scanner in = new Scanner(System.in); System.out.print("IP: "); ip = in.nextLine(); System.out.print("Port: "); port = in.nextInt(); System.out.print("Size of chatroom: "); roomSize = in.nextInt(); - in.close();*/ + in.close(); ip = "localhost"; port = 3001; roomSize = 2; diff --git a/JChatServer/src/pad/prac2/MySocket.java b/JChatServer/src/pad/prac2/MySocket.java index a41eb88..26d367b 100644 --- a/JChatServer/src/pad/prac2/MySocket.java +++ b/JChatServer/src/pad/prac2/MySocket.java @@ -56,7 +56,7 @@ public class MySocket extends Socket String len,str; int length; len = this.readLine(); - if(len == null) + if(len == "") { return len; } -- libgit2 0.22.2