Re: [protobuf] How to serialize empty message in protobuf-3 in C++?

2021-02-05 Thread Ivan Baidakou
Thanks a lot, it helped greatly!

On Saturday, February 6, 2021 at 1:12:44 AM UTC+3 thes...@gmail.com wrote:

> Over the network, you could send the size of the message (which may be 
> zero) and then the message itself. See the example on this page 
> 
>  and 
> steaming multiple messages 
> 
> . 
>
> On Fri, Feb 5, 2021 at 1:26 PM Ivan Baidakou  wrote:
>
>> Hi Nadav,
>>
>> I have to send the message over the network. If it returns the empty 
>> string, there is nothing to send. Anyway, I can see, that the remote side 
>> somehow sends (empty) Pings to me. How I can do the same?
>>
>>
>> On Saturday, February 6, 2021 at 12:05:39 AM UTC+3 thes...@gmail.com 
>> wrote:
>>
>>> Hi Ivan,
>>>
>>> You are doing it correctly. An empty message has zero length when 
>>> serialized. This is also true for messages with only optional fields - an 
>>> empty array of bytes is a valid serialized instance of such a message.
>>>
>>> -Nadav
>>>
>>> On Fri, Feb 5, 2021 at 12:57 PM Ivan Baidakou  wrote:
>>>

 Hi,

 There is a the following message type:

 message Ping {}

 When I invoke for my  object  "proto::Ping " the ping.ByteSizeLong() 
 it returns zero. ping.SerializeAsString() also returns empty string. 

 What can be done?

 Thank you, 
 wbr, basiliscos

 -- 
 You received this message because you are subscribed to the Google 
 Groups "Protocol Buffers" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to protobuf+u...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/protobuf/c5cfa7ca-bd7f-47b5-a993-0427b0e04d06n%40googlegroups.com
  
 
 .

>>>
>>>
>>> -- 
>>> -Nadav
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Protocol Buffers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to protobuf+u...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/protobuf/4990bfa4-20a8-445b-b402-fbb134cde708n%40googlegroups.com
>>  
>> 
>> .
>>
>
>
> -- 
> -Nadav
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/d38e4b73-77c0-4441-8f3a-a003dbe47a6bn%40googlegroups.com.


Re: [protobuf] How to serialize empty message in protobuf-3 in C++?

2021-02-05 Thread Nadav Samet
Over the network, you could send the size of the message (which may be
zero) and then the message itself. See the example on this page

and
steaming multiple messages
.

On Fri, Feb 5, 2021 at 1:26 PM Ivan Baidakou  wrote:

> Hi Nadav,
>
> I have to send the message over the network. If it returns the empty
> string, there is nothing to send. Anyway, I can see, that the remote side
> somehow sends (empty) Pings to me. How I can do the same?
>
>
> On Saturday, February 6, 2021 at 12:05:39 AM UTC+3 thes...@gmail.com
> wrote:
>
>> Hi Ivan,
>>
>> You are doing it correctly. An empty message has zero length when
>> serialized. This is also true for messages with only optional fields - an
>> empty array of bytes is a valid serialized instance of such a message.
>>
>> -Nadav
>>
>> On Fri, Feb 5, 2021 at 12:57 PM Ivan Baidakou  wrote:
>>
>>>
>>> Hi,
>>>
>>> There is a the following message type:
>>>
>>> message Ping {}
>>>
>>> When I invoke for my  object  "proto::Ping " the ping.ByteSizeLong()
>>> it returns zero. ping.SerializeAsString() also returns empty string.
>>>
>>> What can be done?
>>>
>>> Thank you,
>>> wbr, basiliscos
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Protocol Buffers" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to protobuf+u...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/protobuf/c5cfa7ca-bd7f-47b5-a993-0427b0e04d06n%40googlegroups.com
>>> 
>>> .
>>>
>>
>>
>> --
>> -Nadav
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/protobuf/4990bfa4-20a8-445b-b402-fbb134cde708n%40googlegroups.com
> 
> .
>


-- 
-Nadav

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/CANZcNEqFp21Q_WpJ_eYJjjLmMz8%2BToLA9TXNv7z_PY4%2BreQ76Q%40mail.gmail.com.


Re: [protobuf] How to serialize empty message in protobuf-3 in C++?

2021-02-05 Thread Ivan Baidakou
Hi Nadav,

I have to send the message over the network. If it returns the empty 
string, there is nothing to send. Anyway, I can see, that the remote side 
somehow sends (empty) Pings to me. How I can do the same?


On Saturday, February 6, 2021 at 12:05:39 AM UTC+3 thes...@gmail.com wrote:

> Hi Ivan,
>
> You are doing it correctly. An empty message has zero length when 
> serialized. This is also true for messages with only optional fields - an 
> empty array of bytes is a valid serialized instance of such a message.
>
> -Nadav
>
> On Fri, Feb 5, 2021 at 12:57 PM Ivan Baidakou  wrote:
>
>>
>> Hi,
>>
>> There is a the following message type:
>>
>> message Ping {}
>>
>> When I invoke for my  object  "proto::Ping " the ping.ByteSizeLong() 
>> it returns zero. ping.SerializeAsString() also returns empty string. 
>>
>> What can be done?
>>
>> Thank you, 
>> wbr, basiliscos
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Protocol Buffers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to protobuf+u...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/protobuf/c5cfa7ca-bd7f-47b5-a993-0427b0e04d06n%40googlegroups.com
>>  
>> 
>> .
>>
>
>
> -- 
> -Nadav
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/4990bfa4-20a8-445b-b402-fbb134cde708n%40googlegroups.com.


Re: [protobuf] How to serialize empty message in protobuf-3 in C++?

2021-02-05 Thread Nadav Samet
Hi Ivan,

You are doing it correctly. An empty message has zero length when
serialized. This is also true for messages with only optional fields - an
empty array of bytes is a valid serialized instance of such a message.

-Nadav

On Fri, Feb 5, 2021 at 12:57 PM Ivan Baidakou  wrote:

>
> Hi,
>
> There is a the following message type:
>
> message Ping {}
>
> When I invoke for my  object  "proto::Ping " the ping.ByteSizeLong()
> it returns zero. ping.SerializeAsString() also returns empty string.
>
> What can be done?
>
> Thank you,
> wbr, basiliscos
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/protobuf/c5cfa7ca-bd7f-47b5-a993-0427b0e04d06n%40googlegroups.com
> 
> .
>


-- 
-Nadav

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/CANZcNEqfOXWSXnwG1Lwd59_no-kN9D1Vvngz5mPRJ2Rsd2oRdg%40mail.gmail.com.