Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

one client and two servers  RSS feed

 
Medes Agri
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

now I have created my applications but I think it does not work correctly.

I have two servers and one client , the client must get data from the servers simultaneously.

It get the data from them, but it sometimes does not work correctly, and it writes the data from one of the servers.
here is my code.

[ July 10, 2006: Message edited by: Medes Agri ]
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After sending their results, your servers are immediately exiting. This can result in the data being discarded by the operating system before the client has a chance to read it. The servers can either loop to service another client (which is of course what servers normally do) or they can just do a "System.in.read()", to wait for you to press Enter before they exit. Either way, that should fix the client.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!