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.
Readers and Writers are for text. Use the input and output streams directly, or via a BufferedOutputStream with appropriate flushing.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.