My problem here was that I was using I was using ParseFromString, after 
reading from socket. In order to get this to work I had to use 
ParseFromArray. 


Not working code

            len = recvfrom(sockfd, buffer, MAX_LENGTH ,
            MSG_WAITALL, (struct sockaddr*) &cliaddr, (socklen_t*) &size);

            if (len > 0) {
                // Add ending string to buffer.
                buffer[len] = '\0';
                string data = string(buffer)
                common::Message message;
                if (message.ParseFromString(data)) {

working code
            len = recvfrom(sockfd, buffer, MAX_LENGTH ,
            MSG_WAITALL, (struct sockaddr*) &cliaddr, (socklen_t*) &size);

            if (len > 0) {
                // Add ending string to buffer.
                buffer[len] = '\0';
                common::Message message;
                if (! message  .ParseFromArray(buffer, len+1)) { 
On Friday, September 23, 2022 at 4:52:25 PM UTC-4 [email protected] wrote:

> Can you provide a reproduction for us?
>
> On Fri, Sep 23, 2022 at 1:38 PM Timothy Sutton <[email protected]> 
> wrote:
>
>> I am having issues parsing messages with doubles inside of C++ they seem 
>> to end up always zero when I parse them. I can seem that int fields are 
>> being populated with the correct data, but not doubles. I tried using both 
>> the 3.21 and 3.15 libraries to no success. If I parse these same messages 
>> with my java application I see that I get the results as expected. 
>>
>> Has anyone seen a similar problem? 
>>
>> -- 
>> 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 [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/protobuf/f2aeb80a-0e16-4c26-beda-d58b13f4a579n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/protobuf/f2aeb80a-0e16-4c26-beda-d58b13f4a579n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/13cc615f-a075-4130-bc24-2344182f04d0n%40googlegroups.com.

Reply via email to