title: How to send message FROM Chrome extension TO Native app?
body: <p>I have a native-app written in c++. </p>
  
  <p>I am able to send data from my native-app to chrome extension using <a href="https://stackoverflow.com/questions/18134665/how-to-send-message-from-native-app-to-chrome-extension">How to send message FROM native app TO Chrome extension?</a></p>
  
  <p>But I am unable to figure out the other way.</p>
  
  <p>Chrome doc. states : <em>Chrome starts each native messaging host in a separate process and communicates with it using standard input (stdin) and standard output (stdout). The same format is used to send messages in both directions: <strong>each message is serialized using JSON, UTF-8 encoded and is preceded with 32-bit message length in native byte order.</em></strong></p>
  
  <p>how do I read/interpret data from stdin, sent by the chrome-extension?</p>
  
  <p>How do I read 4byte length information and also the rest of the data that is being sent UTF-8 encoded?</p>
  
  <p>Please help!</p>
  
  <p>Thanks!</p>