I have a class that will send data in java, the server requires a certain string to actually work.
I am sending the correct string, this is the connection and sending process:
// CONNECT
try {
// GET SERVER IP
InetAddress serverAddr = InetAddress.getByName(this.terminalIp);
// CREATE SOCKET
Socket hcmSocket = new Socket(serverAddr,this.terminalPort);
PrintWriter sendingStream = new PrintWriter(new BufferedWriter(new OutputStreamWriter(hcmSocket.getOutputStream())), true);
BufferedReader recivingStream = new BufferedReader(new InputStreamReader(hcmSocket.getInputStream()));
// SEND REQUEST
sendingStream.println("00 0012552 003365 004152");
The server rejects this even though it is correct.
When I trace the connection with wireshark I see that the hex being sent is adding on an extra 0x000a which is a Line Feed.
My problem is that I don't want that to be sent, I am making sure that the string I am sending it has no extra white space at the end to create this.
This is the Hex I wan to send :30 30 1c 30 30 31 31 30 30 30 1c 30 30 33 32 35 32 1c 30 30 34 31 32 35 31
But what is acutally being sent is: 30 30 1c 30 30 31 31 30 30 30 1c 30 30 33 32 35 32 1c 30 30 34 31 32 35 31 0a
Could it be the sendingStream that is automatically adding this in?
printlnmethod's name ...