Commit 7665c8343e0a8c470165d1fcf3cca6f330e415f8

Authored by Imanol-Mikel Barba Sabariego
1 parent 02536032

git-svn-id: svn://imanolbarba.net/PAD@31 c2ee353e-ed0d-4329-bf56-03aec153487f

JChatServer/bin/pad/prac2/Connection.class
No preview for this file type
JChatServer/bin/pad/prac2/JChat.class
No preview for this file type
JChatServer/bin/pad/prac2/MySocket.class
No preview for this file type
JChatServer/src/pad/prac2/Connection.java
... ... @@ -134,6 +134,7 @@ public class Connection extends Thread
134 134 }
135 135 else if(str.equals(""))
136 136 {
  137 + System.out.println(serv.getNickname(this) + " disconnected");
137 138 break;
138 139 }
139 140 else
... ... @@ -145,6 +146,7 @@ public class Connection extends Thread
145 146 catch(IOException ioExc)
146 147 {
147 148 System.out.println("TCP: Error writing to socket");
  149 + System.out.println(serv.getNickname(this) + " disconnected");
148 150 break;
149 151 }
150 152 }
... ...
JChatServer/src/pad/prac2/JChat.java
... ... @@ -9,14 +9,14 @@ public class JChat
9 9  
10 10 String ip;
11 11 int port, roomSize;
12   - /*Scanner in = new Scanner(System.in);
  12 + Scanner in = new Scanner(System.in);
13 13 System.out.print("IP: ");
14 14 ip = in.nextLine();
15 15 System.out.print("Port: ");
16 16 port = in.nextInt();
17 17 System.out.print("Size of chatroom: ");
18 18 roomSize = in.nextInt();
19   - in.close();*/
  19 + in.close();
20 20 ip = "localhost";
21 21 port = 3001;
22 22 roomSize = 2;
... ...
JChatServer/src/pad/prac2/MySocket.java
... ... @@ -56,7 +56,7 @@ public class MySocket extends Socket
56 56 String len,str;
57 57 int length;
58 58 len = this.readLine();
59   - if(len == null)
  59 + if(len == "")
60 60 {
61 61 return len;
62 62 }
... ...