Egretproperties.json file to add the Protobuf library. After the addition is complete, the engine needs to be compiled.2 Writing Protobuf filesCreate a new file Template.protoI'm writing a test data here, User_login3 Loading Protobuf filesNote Type if text 4 using ProtobufRead Template_proto file[C + +]Plain Text view copy code ?
1
var messa
1. Download the source code of protobuf from http://code.google.com/p/protobuf/downloads/list. Decompress, compile, and install the tool to use it. Installation steps are as follows: tar-xzf protobuf-2.1.0.tar.gz CD protobuf-2.1.0. /configure -- prefix =/usr/local/protobuf m
Protobuf the applicable languageAuthentic (Google's own in-house) Protobuf supports three languages: Java, C + +, and Pyton, and unfortunately does not support languages such as. Net or Lua, but the power of the community cannot be overlooked because PROTOBUF is indeed more than JSON, XML has the advantage of speed and ease of use, and can be forward-compatible,
Let's start with the functionality that the examples in this article want to implement:
Serialization of objects based on PROTOBUF
Using sockets to achieve constant communication
Encoding and decoding of data packets
Here's a concrete step:
One, unity in the use of PROTOBUF
Import DLL into Unity,To create a network transport model class:
Using System;
Using
On the acquisition and usage of PROTOBUF see this article: http://www.111cn.net/sj/android/71936.htmI'll just post my example directly below,First, the service side:Key Code Main.java
The code is as follows
Copy Code
Package com.jerome.test;public class Main {public static void Main (string[] args) {New Thread (New Dealthread ()). Start ();}} Dealthread.java Package com.jerome.test;Import java.io.IOException;Import Java.io
Protocol buffers (PROTOBUF) Official Document--PROTOBUF language guideConvention: For the convenience of writing, protocolbuffers in the following will have PROTOBUF replaced.This guide will describe how to use protobuf to define I structured protobuf data, including the. pr
, and distributed programs developed by different departments may communicate with each other, a global organization within the company is required to allocate typeId, every time you add a new message type, you must register it, which is troublesome.
The second approach is better. The uniqueness of typeName is easier, because you can add the package name (that is, use the message's fully qualified type name). Each department divides the namespace in advance without conflict or repetition. Howeve
--------------------------------------------------------------------------------------------------------------- ----------------------------------------------------Earlier in the company to transplant the project to iOS, but protobuf, but there is no use of the situation, and later found on the Internet solution, thank the great God.------------------------------------------------------------------------------------------------------ -----------------
the target language (C++,java,python), is a format defined by Google Protobuf. in fact, this file is not necessary, compile protobuf-2.6.1.tar.bz2 will generate this EXE)Go to the official website to download Protobuf source code and compile tool: Https://developers.google.com/protocol-buffers/docs/downloadsThen unzip: my local path is D:\
C ++ uses protobuf to transmit a byte array containing \ 0 in the middle, and a protobuf Array
The C ++ implementation of protocol buffers returns the byte and string typesStd: string. This structure contains a length function telling you how long the corresponding data is (as well as the data itself.) Thus there is no special significance of embeded\ 0Characters.
The setting functions accept a string too
library vim/etc/ld.so.conf, add/usr/local/protobuf/lib in the file (note: Add at New Line), and then execute the command: Ldconfig
. proto File
The. Proto file is an important Protobuf file that defines the structure that requires serialization of data. The 3 steps to using PROTOBUF are:
1 defining message Formats in. proto files
2 compiling the. proto file with
Http://www.cnblogs.com/csdev/p/4696686.htmlIn the previous communication between C # Server and Java client based on Networkcomms V3 communication Framework, the passing of characters in C # side and Java side communication was discussed, and a friend mentioned that if an integer of type int was passed, the encoding problem would occur.Found an article on the internet, "using Protobuf for C # and Java communication," to learn, using
The question to be addressed in this article is how to automatically create a specific Protobuf message object and deserialize it after receiving the PROTOBUF data. "Automatic" means that when a new Protobuf message type is added to a program, this part of the code does not need to be modified and does not need to register the type of messages itself. In fact, Go
iOS .To learn about the JIT and the AOT, see the following URLs :Jit:http://en.wikipedia.org/wiki/just-in-time_compilationAot:http://en.wikipedia.org/wiki/aot_compilerHttp://www.mono-project.com/AOTAfter an attempt, you can use protobuf-net precompilation to run on iOS and Android devicesNext, follow the steps, and finally attach the test project.First, download protobuf-net and configurationGo to Http://
. as google puts it: "Protocol buffers Are now Google's lingua franca for data "and if it's good enough for google, then it must be worth checking out!
We use protocol buffers to serialize persistant data for our IOS and Android games. creating classes that persist data like shop, high scores, player preferences, achievements can be done in minutes with protobuf. and that why we♥Protobuf!
This is not a
DescriptionProtobuf has been fully migrated to GitHub, address: https://github.com/google/protobufDownload Direct 2.6.1 Version: Https://github.com/google/protobuf/archive/v2.6.1.zipI turned to Linux soon so the various system paths to Linux are not particularly familiar with the online read a few tutorials are not mentionedAdd Library_path path, resulting in a custom installation path when the link is not (especially the default installation path of
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.