Encode length flag in network byte order.

The length flag should be in network byte order when going over the network,
otherwise the lengths will be interpretted different based on the endianness
of the machine.

It is not reencoded immediately upon receival, since it is relayed directly
after. Still, it should it be encoded on send so that the receiver can
assume NBO.