File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes Server/Client problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Server/Client problem" Watch "Server/Client problem" New topic

Server/Client problem

jim delmar

Joined: Feb 02, 2012
Posts: 1
Hello guys!! New one here. I hava a problem with my code.
Here 's the server code

and here is the client's

So i make a server who waits for connections.When a client connects, if we(the server) send the command showinfo, it responds with some system information.The problem is that it is a multithreaded server and many clients connect.So if for example connect 2 clients at the server we have to type 2 times showinfo and then the clients give us the information. How can i make the clients respond immediately with typing showinfo for each one and don't wait until i type showinfo for all the clients. It's a bit tiring to type 50 times showinfo if there are 50 clients before you can execute your command. Thank you in advance (i have tried some thread synchronization and some sleep() join() commands but i haven't reach a conclusion i hope you can help a bit.)
subject: Server/Client problem
It's not a secret anymore!