This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Irregular messaging between server and telnet client.  RSS feed

 
rewati raman
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have made a server program that can be used to chat with a telnet client. Here is the code. There is a problem with it.
the message between server and client is irregular and i am not able to understand it. I am attaching the output below.







 
Andrey Kozhanov
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

Your problem is on 52nd line of code. It is said in java documentation:

public boolean hasNextLine()
Returns true if there is another line in the input of this scanner. This method may block while waiting for input.

This is exactly what happening with your server - it's execution does not proceed until user enters something on server side.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!