Hi,

I'm working on the spotware connect api which uses c# port of the protobuf 
library 
(https://sandbox-connect.spotware.com/draftref/downloads/spotware-connect-samples.zip).

The prototype of one of the message (ProtoPingReq) is defined as below:

message ProtoPingReq {
>     optional ProtoPayloadType payloadType = 1 [default = PING_REQ];
>     required uint64 timestamp = 2; // timestamp that will be returned in 
> the response
> }




when using the supplied c# sample , the PingReq serialized to :

Data sent: 00 00 00 0E
> Data sent: 08 34 *12 0A* 10 9C DA EC A6 BB C9 D3 E8 08
>

the message length is 0xe and there is payload id (timestamp) - 0x12, and 
payload length 0x0A.

However, when serialize using c++:

the packet is

> 00 00 00 0c 

08 34 10 f0 d5 fe 81 92  86 e0 e7 01 


the length is 0xc (due to the missing payloadid (timestamp) / length) .

I've tried using the latest libproto buf (2.5.0) and later downgraded to 
same version of c# project (2.4.1) but the problem remains.

below are code snippet to serialize the PingReq message:

 ProtoPingReq pingReq;
>>     pingReq.set_payloadtype(PING_REQ);
>>     char buf[BUFSZ + 1]; // BUFSZ is 1024 
>>
>    
>>         SYSTEMTIME systemTime;
>>         GetLocalTime(&systemTime);
>>
>>         FILETIME fileTime;
>>         SystemTimeToFileTime(&systemTime, &fileTime);
>>
>>         ULARGE_INTEGER largeInteger;
>>         largeInteger.LowPart = fileTime.dwLowDateTime;
>>         largeInteger.HighPart = fileTime.dwHighDateTime;
>>
>>         ULONGLONG ticks = reinterpret_cast<ULONGLONG&>(largeInteger);    
>>         
>
>  
>
>         pingReq.set_timestamp(ticks);
>>
>>         if(pingReq.SerializeToArray(buf, BUFSZ)) { // output pingReq to 
>> buf
>>             ::google::protobuf::uint32 size = htonl(pingReq.ByteSize());
>>             char* _size = (char*)&size;
>>             
>>             dump_addr(_size, sizeof(uint32));
>>             
>>             dump_addr(buf, pingReq.ByteSize());
>>         }
>>
>
Compiler is msvc 2012, protobuf version: 2.4.1

thanks,
kee

-- 
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 post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to