• Post Reply Bookmark Topic Watch Topic
  • New Topic

Processing server responses

 
Richard Robbins
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing a client/server application wherein I send to the server an object. When the server receives the object, it sends a "Done" reply in the form of a regular String object. For some reason, my client isn't able to read the object. I have used ObjectInputStream(socketConnection.getInputStream()) while having the server send using ObjectOutputStream(socketConnectin.getOutputStream()) to send a String object. My client keeps blocking as if waiting for something to be written to the stream by the server, but the server code appears that it alread has written a String object to the stream. What might be causing this?
 
Richard Robbins
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I fixed this one. I changed my server implementation to use a PrintWriter and a BufferedOutputStream with the connection's getOutputStream() method. I then used a BufferedReader with an InputStreamReader filter to receive the message on the client side.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!