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