• 企业400电话
  • 微网小程序
  • AI电话机器人
  • 电商代运营
  • 全 部 栏 目

    企业400电话 网络优化推广 AI电话机器人 呼叫中心 网站建设 商标✡知产 微网小程序 电商运营 彩铃•短信 增值拓展业务
    protobuf简单介绍和ubuntu 16.04环境下安装教程

    protobuf简单介绍

          protobuf是谷歌的开源序列化协议框架,结构类似于XML,JSON这种,显著的特点是二进制的,效率高,主要用于通信协议和数据存储等方面,算是一种结构化数据的表示方法。

    protobuf的优点

    protobuf的缺点

    xml是自我描述的,但是protobuf格式不是的,给你一段二进制文件,你看不出来作用

    protobuf使用步骤

    比如定义一个结构化数据person,包含name和email属性

    xml中这样定义

    <person>
     <name>zhangsan</name>
     <email>zhangsan@qq.com</email>
    <person>

    protobuf这样定义

    person{
     name:"zhangsan"
     email:"zhangsan@qq.com"
    }

    json中这样定义

    {
     "person":{
      "name":"zhangsan",
      "email":"zhangsan@qq.com"
     }
    }

    protobuf的语法

    Message定义 

      一个message类型定义一个请求或相应的消息格式,可以包含多种类型

    Service服务 

      如果需要将消息类型用在rpc上面,那就需要在.proto文件定义一个rpc服务接口,protocol buffer编译器会根据所选择的不同语言生成服务接口代码。

    protobuf在ubuntu 下安装 【版本16.04】

      官方地址:https://github.com/google/protobuf/blob/master/src/README.md

    安装命令行如下:

    $ sudo apt-get install autoconf automake libtool curl make g++ unzip
    $ git clone https://github.com/google/protobuf.git
    $ cd protobuf
    $ git submodule update --init --recursive
    $ ./autogen.sh
    $ ./configure
    $ make
    $ make check
    $ sudo make install
    $ sudo ldconfig # refresh shared library cache.

    make之后的截图


    中途编译一路顺风,没有遇到什么问题,下面查看下版本吧

    $ protoc --version12

    总结

    以上所述是小编给大家介绍的protobuf简单介绍和ubuntu 16.04环境下安装教程,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!
    如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!

    上一篇:在 Ubuntu 上安装 Protobuf 3 的教程详解
    下一篇:VMware 12 下 Ubuntu 16.04 安装图文教程
  • 相关文章
  • 

    © 2016-2020 巨人网络通讯

    时间:9:00-21:00 (节假日不休)

    地址:江苏信息产业基地11号楼四层

    《增值电信业务经营许可证》 苏B2-20120278

    protobuf简单介绍和ubuntu 16.04环境下安装教程 protobuf,简单,介绍,和,ubuntu,