Budric Bundy <[email protected]> wrote on 12/17/2013 11:07:56 AM:

> From: Budric Bundy <[email protected]>
> To: [email protected], 
> Date: 12/17/2013 11:08 AM
> Subject: Re: streaming binary data
> 
> Thanks Ben,
> 
> I dug through the code and I can't find the TSocket information you
> mentioned.  TConnectionInfo is defined as follows in TProcessor.h:
> struct TConnectionInfo {
>   // The input and output protocols
>   boost::shared_ptr<protocol::TProtocol> input;
>   boost::shared_ptr<protocol::TProtocol> output;
>   // The underlying transport used for the connection
>   // This is the transport that was returned by 
TServerTransport::accept(),
>   // and it may be different than the transport pointed to by the input 
and
>   // output protocols.
>   boost::shared_ptr<transport::TTransport> transport;
> };
> 
> TTransport doesn't have TSocket or getPeer*(), and neither does 
TProtocol.
>  I'm using thrift 0.9.1.  I'm also using TThreadPoolServer which also 
has
> no accessor methods to socket.
> 
> Thanks.

Downcast the transport member to a TSocket with code similar to the 
following:
boost::shared_ptr<TSocket> sock = 
boost::dynamic_pointer_cast<TSocket>(connInfo.transport);

Note that if you change your underlying transport to something else (like 
TSSLSocket), you will need to change your dynamic_pointer_cast as well.

Reply via email to