odd behavior while transmit byte[] -> String -> Socket -> String -> byte[]
Hello friends!
I develop application for WPAN controlling. Everything works ok except one moment.
I have frame (byte array) which include IP address, type of operation, id parameter. Then I send this frame through the sockets. So all frames are sending and receiving properly except one.
Here is simple example of my problem (pay please your attention on figure 10 at the end of frame)
in servelet
byte[] frame = {100, 100, 100, 100, 1, 10};
outWpan = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())),true);
strFrame = new String (frame);
// send to the WPAN server from servlet
outWpan.println(strFrame);
in socket server
--
byte[] frame;
while (true) {
String str = in.readLine();
if(str.equals("END"))
break;
// get bytes from servlet client
frame = str.getBytes();
System.out.println("the lenght of frame " + frame.length + "\n");
for(int i=0; i<frame.length; i++)
System.out.println(frame + "\n");
}
So if the id (last digit in the frame) is 10 - it doesn’t transmit this '10' to the destination socket and after this operation frame recieve {100, 100, 100, 100, 1} frame i.e. length is 5 instead 6 and it loses this last figure. In others cases everything is ok - for example if I change in my HTML page id operation on arbitrary figure it works.
I will be thankful for any guess.
Thank you.
>

