This implements the packet scheme that the embedded protocol uses when communicating over stdin and stdout.