• Post Reply Bookmark Topic Watch Topic
  • New Topic

Irregular messaging between server and telnet client.

 
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!