Kryonet Size Of Packets

Second post on this, just trying to get my head straight.

How does sending 1 Byte:

http://puu.sh/aqxWA/0d7b52c914.png

Output as 6 Bytes?:

http://puu.sh/aqxUK/5e2afb83b9.png

I looked at the src but don’t really understand what is happening - I see that sendTCP prints out length - what is the significance of ‘length’ in terms of bandwidth?.. like, how many Bytes am I actually sending (including overhead) with my call to sendTCP(byte);?

I think it’s because the actual data you’re sending is one byte, but the actual packet it sends contains more data, which is neccesary for delivering it at the right place. Packets can be divided up in two parts, the header and the payload. The payload you’re sending is one byte (It can be more, depends on KryoNet maybe sending some extra things, not sure about this one) but the header contains additional information like the IP address and port number, maybe some other stuff too. That’s what’s causing the extra bandwidth I think.

The minimum packet size for TCP is larger than 6 bytes, so it’s likely Kryonet’s overhead. My guess is because Kryonet serializes the entire byte object (it’s not just a primitive byte)

Kryonet serializes class information. I don’t know if in the case of a Byte it just treats it as a byte for sending over the wire. But that could cause more size than you expect.