2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 # This native client will read full messages, but do nothing with them and
13 # Read the message type (first 4 bytes).
14 typeBytes
= sys
.stdin
.read(4)
16 if len(typeBytes
) == 0:
19 # Read the message length (4 bytes).
20 textLength
= struct
.unpack('i', sys
.stdin
.read(4))[0]
22 # Read the text (JSON object) of the message.
23 text
= sys
.stdin
.read(textLength
)