Meaningless Drivel is fun!*
The moose likes I/O and Streams and the fly likes Question regarding I/O streams Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Question regarding I/O streams" Watch "Question regarding I/O streams" New topic
Author

Question regarding I/O streams

Charles Sexton
Ranch Hand

Joined: Sep 26, 2013
Posts: 193
The question is when you send two messages from the client to the server does the server read the messages as one input or do you have to read both inputs on the server side?


Im using DataInputStream and DataOutputStream

On the client side I send two messages one for the database action to be performed and the send is the information needed to get the job done.

Example I want to search for a product in the database.

I send to the server an output message saying search product.
I then send to the server which product I want to be searched.

The server then retrieves the message by in.readUTF();
switch statement determines what database action should be performed.
Within that case I call another in.readUTF() to pass the information to the database on what product to search for.

Would this work or would the server read both messages from the client as one input stream?
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3646
    
  15
I would imagine it wouldn't take much effort to write some code to test that.


Joanne
Charles Sexton
Ranch Hand

Joined: Sep 26, 2013
Posts: 193
Joanne Neal wrote:I would imagine it wouldn't take much effort to write some code to test that.


ok I will write some code.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question regarding I/O streams