Fix code formats.
Fix to fail read length

The appended length is read one byte with short type or
three bytes with int type leaves data in the input byffer.
The left data can be read from another socket.