Thriftpy / thriftpy2

Pure python approach of Apache Thrift.
MIT License
572 stars 91 forks source link

if I update thrift server to thriftpy2 ,should I update the client? #143

Closed djk454772303 closed 3 years ago

djk454772303 commented 4 years ago

my client is coded in C.

ethe commented 4 years ago

No, you do not have to.

ethe commented 4 years ago

Please use the protocol and transport which thriftpy2 supports.

djk454772303 commented 4 years ago

No, you do not have to.

But when I do this, my c client come to exception. The server can receive the request and return normal ,but the C client cannot receive the response.

djk454772303 commented 4 years ago

Please use the protocol and transport which thriftpy2 supports.

This means I should update my C client include file?

djk454772303 commented 4 years ago

Please use the protocol and transport which thriftpy2 supports.

The protocol I used is TBinaryProtocol and The transport I used is TBufferedTransport.

ethe commented 4 years ago

Keep IDL, protocol and transport are the same in both server and client.

djk454772303 commented 4 years ago

Keep IDL, protocol and transport are the same in both server and client.

how can i use the type defined in IDL in my python file?

djk454772303 commented 4 years ago

my server python main code : iprot_factory_m = TBinaryProtocolFactory(strict_read=False, decode_response=False) oprot_factory_m = TBinaryProtocolFactory(strict_write=False, decode_response=False) server = TSimpleServer(processor, server_socket, iprot_factory= iprot_factory_m, oprot_factory=oprot_factory_m)

my client C main code: boost::shared_ptr socket(new transport::TSocket(serv_now.ip, serv_now.port)); boost::shared_ptr transport(new transport::TBufferedTransport(socket)); boost::shared_ptr protocol(new protocol::TBinaryProtocol(transport)); DaClient client(protocol); ..

I think the server and the client use the same protocol and transport.

The C client code used the file the is the generated by thrift, and the server python code directly used the IDL file, and the IDL file is the same.

JonnoFTW commented 3 years ago

@djk454772303 what does your .thrift file look like?

ethe commented 3 years ago

Re-open if more info is provided.