posted 11 years ago
I am building a peer-peer application.
I am sending a fixed size byte array over the network using DataOutputStream and receiving it at the server end using DataInputStream.
Let's say the byte array that is sent, looks something like this { 34, -124, 56, -89}. At the receiving end, I get the following {00, 34, -124, 56}
Essentially, the first byte in the array is replaced by 10 and sometimes by 00 and it slides the other bytes down, hence messing the whole list up.
Also, when i run the the 2 peers locally on my system, this doesn't happen. The moment i run them on 2 different machines over the internet, this thing acts up.
Also lets say A connects to B, then this happens only when i have data to be sent from B-->A and not A-->B. Weird!!!
Can someone tell me the reason this is happening? Or another way to avoid this?
Spent the whole day breaking my head over it. I need a solution urgently.
Thanks in advance.