Fix packet length encoding

The current packet length is bogus, but it somehow works. Following the
protocol description at http://wiki.vg/Protocol, let's prepend the
correct calculated packet length.