title: Creating a Thrift server on stdin with C++
body: <p>I wonder if it's possible to create a Thrift server that would listen on stdin and write the answers to stdout. I found the TFDTransport in Thrift.  </p>
  
  <pre><code>int fd = fgetc( stdin );
  shared_ptr&lt;TFDTransport&gt; innerTransport(new TFDTransport(fd));
  shared_ptr&lt;TBufferedTransport&gt; transport(new TBufferedTransport(innerTransport));
  </code></pre>
  
  <p>What I am not sure is how to create a Thrift server that would listen on stdin and write answers to stdout. Here is the standard way of initializing a new server:</p>
  
  <pre><code>shared_ptr&lt;TJSONProtocol&gt; protocol(new TJSONProtocol(transport));
  TSimpleServer server(processor,
                     serverTransport,
                     transportFactory,
                     protocolFactory);
  </code></pre>
  
  <p>But at this point I am not sure how to progress. Is creating a server on stdin/stdout even possible with Thrift and if so how to create such a server?</p>