protocol-buffers

Import and usage of different package files in protobuf?

我与影子孤独终老i 提交于 2021-02-04 21:59:05
问题 I have imported an other proto which having different package name than mine. For usage of messages from other package, have accessed that message with package name. For Example : other.proto package muthu.other; message Other{ required float val = 1; } myproto.proto package muthu.test; import "other.proto"; message MyProto{ required string str = 1; optional muthu.other.Other.val = 2; } Is there a way to use val of muthu.other package directly like optional val = 2; instead of using muthu

Why is my Protobuf message (in Python) ignoring zero values?

ぃ、小莉子 提交于 2021-02-04 17:16:40
问题 I've been working on implementing protobufs for IPC for a project. For some reason, values that are set to 0 are not being set/serialized. For context, the .proto file contains the following message: syntax = "proto3"; enum SetGet { SET = 0; GET = 1; } message State { SetGet setget = 1; double x = 2; double y = 3; double depth = 4; double yaw = 5; double pitch = 6; double roll = 7; } I compile the file to a Python _pb2 file with protoc, and then I try running the following test script: import

Sending and receiving protobuf data over Socket via boost asio

大憨熊 提交于 2021-01-29 22:16:10
问题 I want to send Protobuf data from my server to my client thanks to a TCP socket. I tested my client and my server and the TCP connexion works. So I try to serialize my data and send it by using a streambuf. In my server : void SendData(protobufType data){ std::ostream ostream(&this->m_streambuf); data.SerializeToOstream(&ostream); std::cout<<"Send data"<< std::endl; boost::asio::write(this->m_socket, this->m_streambuf); } In my client : boost::asio::streambuf response; boost::asio::read

Generating c# files from .proto files using protoc on pre build event in VS 2017

喜夏-厌秋 提交于 2021-01-29 13:35:26
问题 I tried to generate c# files from .proto files using protoc from google.protobuf.tools nuget package on pre build event in Visual Studio 2017 for all .proto files in particular folder. I created .net core library project with .proto files. Pre-build event command line for for that protoc -I=$(ProjectDir)Messages --csharp_out=$(ProjectDir)Messages $(ProjectDir)*.proto where protoc is environment variable for precompiled version of protoc.exe But I got error error MSB3073: The command "protoc

Go protobuf packages collision

末鹿安然 提交于 2021-01-29 12:44:13
问题 Hi I am trying to generate the simple protobuf file in Go language syntax = "proto3"; package gen; message EvtKeepAlive { string SvcName = 2; } In the header I see that the package uses two different proto go implementations, one from github.com and one from google.golang.org . As far as I understand the latter supersedes the former, so is this file generation valid? // versions: // protoc-gen-go v1.25.0-devel // protoc v3.13.0 // source: common.proto package gen import ( proto "github.com

Generate a DLL which uses protocol-buffers

不问归期 提交于 2021-01-29 11:04:18
问题 I am working on a C++ (VS2017) project that uses a protobuf type I created. However, this project requires a .dll of said protobuf type. The __declspec( dllexport ) in each class declaration are not there by default, and I read online that they can be added by generating the protobuf object with this command line: --cpp_out=dllexport_decl=MY_EXPORT_MACRO:output/directory No one has explained what MY_EXPORT_MACRO is or how to define it. When I first generated my protobuf objects I used the

WCF protobuf endpoint 400 bad request

我的未来我决定 提交于 2021-01-29 07:05:23
问题 I have WCF service with DataContract json serialization. I would like to add service endpoints to consume Protobuf data messages. I tried to use nugget package ProtoBuf.Services.WCF. Added endpoint via web.config configuration. However, every request on protobuf endpoint with address "proto" returns 400 Bad request. Web.config sample is written bellow. Endpoint with default address "" works properly. Get method: HTTP 200 OK http://localhost:65460/BeaconService.svc/GetData HTTP 400 BAD REQUEST

python protobuf install for windows

此生再无相见时 提交于 2021-01-28 08:04:17
问题 I am currently trying to install version 3 of google protocol buffer on windows for python. I have gone to the python folder through the command line and I am attempting to use: python setup.py build however I am getting the following error: python : protoc is not installed nor found in ../src. Please compile it or install the binary package. What's going on here? 回答1: As the error says, you must first install protoc.exe . You can get it from the Win32 package included with every Protobuf

Plain struct from protocol buffer message

守給你的承諾、 提交于 2021-01-28 08:01:00
问题 Is there a way to obtain a simple struct from protocol buffers message in C++? i.e. struct PlainFoo { int32_t bar; float baz; }; from message Foo { required int32 bar = 1; required float baz = 2; } I obtain some data over network in a protocol buffer and I'd like to be able to add it to other similar data and store it in a compact representation for internal use without having to basically copy the message declaration in my code. I know I can use the generated message class itself, but it has

How secure the protobuf is to get some of the data out?

有些话、适合烂在心里 提交于 2021-01-28 00:37:42
问题 Without any encryption, if the recipient has the serialized Protobuf file but does not have the generated Protobuf class (they don't have access to the .proto file that define its structure), is it possible for them to get any data in the Protobuf file from the binary? If they have access to a part of the .proto file (for example, just one related message in the file) can they get a part of that data out from the entire file while skipping other unknown parts? 回答1: yes, absolutely; the protoc