Unity3d Java based PROTOBUF communication implementationA recent study of Unity3d, and the need to develop a communication protocol for the game. Because I was born at the back end, the socket-related communication framework for C # is not familiar, after a few days of learning, finally fix. Published here, we can learn together, less detours.This article focuses on demonstrating how to parse and send protocols.Technology selection
Serv
This is a creation in
Article, where the information may have evolved or changed.
Why is there a lot of almost identical and incorrect tutorials on the Internet???
Fucking Open a tutorial about Golang and protobuf, nothing more than to pull the fuck protobuf how awesome, how stupid xml, and then how to install Protobuf
);//must have, in is actually a coded string of binary, so it can also be read from the file; decode in and place in Test2System.out.println (test2);//Direct output can be} catch (IOException e) {TODO auto-generated Catch blockE.printstacktrace ();}System.out.println ("over");}=============================================================3 PROTOBUF Implementation ASN1First, PROTOBUF installation (System envi
greater than 256
sfixed32
always takes 4 bytes
Sfixed64
always takes 8 bytes
bool
The value of the
string
string field must be UTF-8 encoded or 7bit ASCII-encoded text
bytes
can contain any sequence of bytes
modifier-Required: A well-formed message must contain exactly one of the fields.-Optional: A well-formed message must contain no more than one of the fields.-Repeated: The field can
Mac installation ProtobufFirst download from http://code.google.com/p/protobuf/protobufAfter that, you need to install brew[Non-root]Brew install Autoconf[need to across the Great Wall and reach the bigger world]Brew Install AutomakeBrew Install libel[Root]sudo./autogen.sh./configure (First autogen.sh only, if no permissions chmod +x Configure)MakeMake checkMake installProtoc-versionShow Results:sh-3.2# Protoc--versionLibprotoc 3.0.0First handwritten
of data storage and transmission format. all RPC function parameters are defined using PROTOBUF, which is currently used in a large number of RPC communication protocols for Hadoop. 3. Advantages and disadvantages compared to XMLPros: Smaller, faster (very inefficient for XML deserialization), and the tools can be used to generate code automatically. disadvantage: Because the data is stored in binary, it is poor in readability???Second, the API1, the
of data storage and transmission format. all RPC function parameters are defined using PROTOBUF, which is currently used in a large number of RPC communication protocols for Hadoop. 3. Advantages and disadvantages compared to XMLPros: Smaller, faster (very inefficient for XML deserialization), and the tools can be used to generate code automatically. disadvantage: Because the data is stored in binary, it is poor in readability???Second, the API1, the
protobuf flow of UseProtobuf Reference Tutorial: https://www.jianshu.com/p/b135676dbe8dAfter writing the. proto file, run the Protoc.exe compiler with the cmd command line, enter the. proto file path to generate the C # file, and then put the C # file into use in your unity project.This method can generate C # files, but is not recommended. This method starts with a. proto file, and for a written C # entity
a set of vectors with the same type as the back cell.
With the above definition, we can use the Protobuf tool to generate the interface code, which commands the following:
Protoc--cpp_out=. Addressbook.proto
Two files were generated after running: addressbook.pb.cc and Addressbook.pb.h, the code is longer than the paste. Our application can implement serialization/deserialization of parameters through an automatically generated interface, as foll
protobuf Efficient Transmission
The use of protocol buffers can be a good solution to the lack of JSON data transmission, it is a data description language developed by Google, similar to XML can be structured data serialization, can be used in data storage, communication protocols and so on. It is not dependent on language and platform and is extremely extensible. At this stage, the official support of C + +, JAVA, Python and other three programming
Protobuf_for_node library (build/default/libprotobuf_for_node_lib.so). It is linked to by your service-exporting add-ons and by the B) Protobuf_for_node add-on (Build/default/protobuf_for_node. node).Need a) and the Protobuf library in your dyld_library_path and b) in your node_path if you require (' Protobuf_for_node ' ).1.Need A *. Protofile that can generatedesc file is a command-line tool that uses Google:protoc--descriptor_set_out=buftest.desc-
Original: http://blog.csdn.net/kakashi8841/article/details/17334493A few days ago a netizen asked me about Unity3d inside use Protobuf method, a moment something dragged to now just write this article, sorry ha.This article tests the environment:System: WINDOWS 7 (3rd, 6 steps), OS X 10.9 (4th step)Software: VS 2012 (3rd, 6 steps), Eclipse (5th, 6 steps)Hardware: IPad 2 (4th step), Macbook Pro Mid 2012 (4th Step)Article directory:1, about PROTOBUF's C
Tags: des Io ar OS Java for SP strong To introduce"ProtocolBuffers"(Protobuf. I was thinking about the next post in the "producer/consumer model" series: About the data transmission format between producers and consumers. Because protobuf is involved in it, you can simply open a separate post. ★What is protobuf?In order to take care of students who have never h
Let's introduce"ProtocolBuffers"(Protobuf. I was thinking about the next post in the "producer/consumer model" series: About the data transmission format between producers and consumers. Because protobuf is involved in it, you can simply open a separate post.
★What is protobuf?In order to take care of students who have never heard of it, we should first take lite
Cocoaasyncsocket network communication use PROTOBUF installation (v)
Protocol buffers is Google's tools, mainly used to deal with data serialization and deserialization, to the different types of data compression storage, thereby reducing the size of network data transmission.
In general, when we write data protocol, we need to implement multiple data parsing methods for different platforms, while the other function of protocol buffers is a template
Objective:Before using the Npoi plugin to write the Guide table tool, in fact, the data is directly serialized , parsing also need to be deserialized, the steps are more complicated, recently saw a Google open-source project Protobuf , it can be used not only for the export of Excel tabular data, but also for the customization of network communication protocol directly.First, Protobuf Introduction:Protobuf
Transferred from: http://blog.csdn.net/kakashi8841/article/details/17334493A few days ago a netizen asked me about Unity3d inside use Protobuf method, a moment something dragged to now just write this article, sorry ha.This article tests the environment:System: WINDOWS 7 (3rd, 6 steps), OS X 10.9 (4th step)Software: VS 2012 (3rd, 6 steps), Eclipse (5th, 6 steps)Hardware: IPad 2 (4th step), Macbook Pro Mid 2012 (4th Step)Article directory:1, about PROT
.
Yes, we are using protobuf, so the point is to understand this.
can go to the official website or other places to find a tutorial to see, overall is relatively simple, need to focus on the PROTOBUF protocol data type corresponding JS data type.
The way to use Protobuf is also simple:
"You only need to define the data
You can refer to the article "echo service implementation" using Google protobuf rpc. The details are not described in this article.
Google protobuf is only responsible for the packaging and package of messages, and does not include RPC implementation, but contains the RPC definition. Suppose there is the following RPC definition:
service MyService { rpc Echo(EchoReqMsg) returns(EchoRespMsg) }
So
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.