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

Question regarding I/O streams

 
Charles Sexton
Ranch Hand
Posts: 238
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 3742
16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would imagine it wouldn't take much effort to write some code to test that.
 
Charles Sexton
Ranch Hand
Posts: 238
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic