Reputation: 1669
I have the code below to read from my socket connection.
String line = null;
try{
BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
while((line = reader.readLine())!=null){
System.out.println(line);
}
reader.close();
}catch(IOException e){
}
I can successfully connect to it using a TCP client, but when I try and send a message in Hex I am getting unrecognisable characters in return.
I am suspecting I need to convert to ASCII, but how would this be done.
Any help would be appreciated.
Upvotes: 0
Views: 606
Reputation: 310926
Readers and Writers are for text. Use the input and output streams directly, or via a BufferedOutputStream with appropriate flushing.
Upvotes: 1