Reputation: 3257
I know TCP can't lose packets because It is streamed, however. I'm trying to send (with nodejs) a stream with 5 "52" packets. Format of it should be (1,52,1,52,1,52,1,52,1,52) where 1 is length of the packet. I'm receiving the same stream both in C# console App on the same PC what server is. And on android device with Java app in local network.
C# output is:
"1,52,1,52,1,52,1,52,1,52"
But the java output looks like:
"1,52,1,52,52,1,52,1,52"
Nodejs code:
b = new Buffer(1);
b.writeInt8(1,0);
this.sock.write(b);
this.sock.write(String.fromCharCode(event)); //event == 52
Java code:
while(true)
{
int a = in.read(); //in is an instance of InputStream
if(a!= -1)Log.v(getTag(),""+a);
}
Does anyone have an idea what's the problem?
Thanks in advance
/UPDATE: socket.bytesWritten returns 10 so it's not on the server side.
Upvotes: 0
Views: 249
Reputation: 3257
Ok. That was my bad. Inside java application I've had a lost connection handler which was reading one byte to check if connection is still alive, it was taking it from the stream.
Upvotes: 1