Results 1 to 6 of 6
Thread: Thread chat client app
- 05-13-2014, 11:17 AM #1
Member
- Join Date
- Dec 2012
- Posts
- 30
- Rep Power
- 0
Thread chat client app
Hello everyone
I have conceptual question regarding thread in the following code (Head First Java page 518,519)
Once the first message receive from server thread will be dead
What will happen in next time when the server sends a message because when we receive at the end of a first message, it becomes null and it come out from while loop
Thanks
Thanks
Java Code:class IncomingReader implements Runnable { public void run() { String message; try { while ((message = reader.readLine()) != null) { System.out.println("client read " + message); incoming.append(message + "\n"); } } catch (IOException ex) { ex.printStackTrace(); } } }
Last edited by mohsen.noor; 05-13-2014 at 12:50 PM.
- 05-13-2014, 02:04 PM #2
Re: Thread chat client app
Yes, it looks like it exits the while loop when the message is null.
If you don't understand my response, don't ignore it, ask a question.
- 05-13-2014, 02:07 PM #3
Member
- Join Date
- Dec 2012
- Posts
- 30
- Rep Power
- 0
- 05-13-2014, 02:15 PM #4
Re: Thread chat client app
What can cause an end of the input stream?
If you don't understand my response, don't ignore it, ask a question.
- 05-13-2014, 02:22 PM #5
Member
- Join Date
- Dec 2012
- Posts
- 30
- Rep Power
- 0
Re: Thread chat client app
Closing the connection at the end of the message
- 05-13-2014, 02:24 PM #6
Member
- Join Date
- Dec 2012
- Posts
- 30
- Rep Power
- 0
Similar Threads
-
Chat client with IRC
By lok pun in forum NetworkingReplies: 3Last Post: 09-06-2011, 07:48 AM -
Chat Client using Smack API
By sQu3aKy in forum NetworkingReplies: 0Last Post: 05-01-2010, 03:40 AM -
Need help with chat client
By the_flirt in forum NetworkingReplies: 4Last Post: 04-23-2010, 04:49 PM -
Chat Client
By Jessi34 in forum New To JavaReplies: 5Last Post: 12-09-2009, 04:49 PM
Bookmarks