thrift使用传输协议TCompactProtocol - xiaoshe的专栏 - 博客频道 - CSDN.NET
2013-03-20 17:58
1216 查看
thrift使用传输协议TCompactProtocol - xiaoshe的专栏 - 博客频道 - CSDN.NET
默认使用TBinaryProtocol,如何使用TCompactProtocol?
解决方法:
首先确认系统支持算术位移(负数的位移)
在支持的情况下#include <config.h>
因为在文件TCompactProtocol.tcc开头会有:
#if !defined(SIGNED_RIGHT_SHIFT_IS) || !defined(ARITHMETIC_RIGHT_SHIFT)
# error "Unable to determine the behavior of a signed right shift"
#endif
#if SIGNED_RIGHT_SHIFT_IS != ARITHMETIC_RIGHT_SHIFT
# error "TCompactProtocol currently only works if a signed right shift is arithmetic"
#endif
如果没有config.h的话,程序编译到此为止。
接着,
服务端和客户端均#include <protocol/TCompactProtocol.h>
将shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
替换成shared_ptr<TProtocolFactory> protocolFactory(new TCompactProtocolFactory());即可
thrift使用传输协议TCompactProtocol
分类: thrift 2011-07-07 09:25 1092人阅读 评论(1) 收藏 举报behavior如何使用其他传输协议?默认使用TBinaryProtocol,如何使用TCompactProtocol?
解决方法:
首先确认系统支持算术位移(负数的位移)
在支持的情况下#include <config.h>
因为在文件TCompactProtocol.tcc开头会有:
#if !defined(SIGNED_RIGHT_SHIFT_IS) || !defined(ARITHMETIC_RIGHT_SHIFT)
# error "Unable to determine the behavior of a signed right shift"
#endif
#if SIGNED_RIGHT_SHIFT_IS != ARITHMETIC_RIGHT_SHIFT
# error "TCompactProtocol currently only works if a signed right shift is arithmetic"
#endif
如果没有config.h的话,程序编译到此为止。
接着,
服务端和客户端均#include <protocol/TCompactProtocol.h>
将shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
替换成shared_ptr<TProtocolFactory> protocolFactory(new TCompactProtocolFactory());即可
相关文章推荐
- thrift安装 - xiaoshe的专栏 - 博客频道 - CSDN.NET
- ubuntu 使用docker运行redis - smellmine的专栏 - 博客频道 - CSDN.NET
- 让qtwebkit使用gstreamer - tinyle的专栏 - 博客频道 - CSDN.NET
- curl c/c++ api接口使用例程 - Mr_Von的专栏 - 博客频道 - CSDN.NET
- QThread 正确使用方法 - tangaowen的专栏 - 博客频道 - CSDN.NET
- 理解和正确使用Java中的断言(assert) - Leichelle的专栏 - 博客频道 - CSDN.NET http://blog.csdn.net/leichelle/article/deta
- python中做层次聚类,使用scipy.cluster.hierarchy.fclusterdata方法 - Waleking的专栏 - 博客频道 - CSDN.NET
- Android使用自带JSONObject解析JSON数据 - jCuckoo的专栏 - 博客频道 - CSDN.NET
- [转] 最新版的OpenCV中新增加的ORB特征的使用 - merlin_q的专栏 - 博客频道 - CSDN.NET
- 【转载】MongoDB ObjectId详解及使用 - permike的专栏 - 博客频道 - CSDN.NET
- VIM使用小技巧-重新载入文件 - Anything的专栏 - 博客频道 - CSDN.NET
- Maven使用Cargo实现自动化部署 - steveguoshao的专栏 - 博客频道 - CSDN.NET
- libcurl 多线程使用注意事项 - Balder~专栏 - 博客频道 - CSDN.NET
- Thrift 学习笔记1——Ubuntu环境下Thrift的安装、编译以及测试 - 张进の专栏 - 博客频道 - CSDN.NET
- AlteraFPGA使用通用SPIFlash - 张亚群的技术专栏 - 博客频道 - CSDN.NET
- dump 分析模式之 INCORRECT STACK TRACE - djm2005dy的专栏 - 博客频道 - CSDN.NET
- JS 动态修改 input 的 type 属性 - teresa502的专栏 - 博客频道 - CSDN.NET http://blog.csdn.net/teresa502/article/details/6546361
- linux安装intel tbb - 大周辞寒的专栏 - 博客频道 - CSDN.NET
- GB2312的编码规则 - HEROWANG的专栏 - 博客频道 - CSDN.NET
- 二叉排序树C实现(含完整源码) - 兰亭风雨的专栏 - 博客频道 - CSDN.NET