aspose file tools*
The moose likes Java in General and the fly likes Client/Server networking Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Client/Server networking" Watch "Client/Server networking" New topic
Author

Client/Server networking

mike hengst
Ranch Hand

Joined: Oct 19, 2002
Posts: 43
I am not sure this is the right forum to ask my question but here goes. I am trying to write this application that calls for a client and a server along with other classes which I have not got to yet. Here is the problem: The client won't accept input. I had it working at one point but had to fix a bug and now it does not accept user input. If someone could just take a look at my code and tell me where my error is I would appreciate it greatly. Here are the client and server classes:




Thank you Oh Lord<br />For the white blind light<br />A city rises from the sea<br />I had a splitting headache<br />from which the future's made<br />--morrisson
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

My favorite part of the code:


Please ignore post, I have no idea what I am talking about.
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

The client won't accept input.

If this is the problem I don't understand why you are posting more than just the Client class.
You have all sorts of debugging print statements in the code already, so you should be able to give us a better clue as to where the problem is.

Is it possible that you are just missing a "System" in front of the last line here?
mike hengst
Ranch Hand

Joined: Oct 19, 2002
Posts: 43
I posted my server and thread classes so you could see where I was sending the input from the client. out is my printwriter and outputs to the server the user input. The problem is once the client displays a menu it is supposed to accept user inputs such as 1 or 2 or 3 etc and sends that to the server to retrieve a file etc... Instead the cursor just sits there.???
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Your client is connecting and then reading somethign from the server. Any chance the server is not sending anything?
here's a little socket project of my own:
http://www.surfscranton.com/architecture/CmdServer.htm
I'm new at sockets, and haven't implemented shutdown commands, so it's not perfect. I posted it on my site to solicit any and all constructive comments.
The client spawns a separate thread to read responses from the server, allowing the server to send zero to many responses to any request. The client will never get "hung" waiting for something from the server.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Forgot the StreamReader.
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986


Am I missing something here? How do you ever get out of these loops?
mike hengst
Ranch Hand

Joined: Oct 19, 2002
Posts: 43
Here is the code I have working:


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Client/Server networking