This content has been marked as final. Show 2 replies
How is the server sending the String?
- if it's using DataOutputStream.writeUTF(), you have to use DataInputStream.readUTF()
- if it's using PrintWriter.println(), or BufferedWriter.write()/newLine(), you have to use BufferedReader.readLine()
- if it's using Writer.writeChars() you have to use Reader.readChars()
- if it's using DataOutputStream.writeBytes() or write() you have to use DataInputStream.read().
- ... etc, you get the picture
And turning a DataInputStream into a String with toString() doesn't give you any of the input it has read. You have to store the data you've read somewhere.