Re: [protobuf] Send structure over network

2013-08-21 Thread Christopher Head
On Tue, 20 Aug 2013 04:26:41 -0700 (PDT)
utkarsh deep  wrote:

> I want to send the structure over a network and my computer is Little 
> Endian and Host Computer is Big Endian . 
> Suppose I want to send 
> 
> 
> 
> struct Contract_DESC CD;
>  char CounterPartyBrokerId[5];
>  char Reserved4;  // byte
>  char Reserved5;
>  char Reserved10;// byte
>  char CloseoutFlag;
>  char Reserved6;  // byte
>  short OrderType;
>  double OrderNumber;
>  char AccountNumber[10];
>  short BookType;
>  short Buy_SellIndicator;
>  long DisclosedVolume;
>  long DisclosedVolumeRemaining;
>}
> 
[snip]
> can some one write the code with sockets involved 
> I am new to this Protocol Buffer . Can u write the code for this
> structure please ?
> 

Hello,
That’s not how Protobuf works. Protobuf doesn’t let you pack data into
an arbitrary format, like you have listed above. Protobuf uses its own
format; you only specify what data you want to encode, not how.
Protobuf will not help you implement the protocol you described.

Chris


signature.asc
Description: PGP signature


[protobuf] Send structure over network

2013-08-20 Thread utkarsh deep
I want to send the structure over a network and my computer is Little 
Endian and Host Computer is Big Endian . 
Suppose I want to send 



struct Contract_DESC CD;
 char CounterPartyBrokerId[5];
 char Reserved4;  // byte
 char Reserved5;
 char Reserved10;// byte
 char CloseoutFlag;
 char Reserved6;  // byte
 short OrderType;
 double OrderNumber;
 char AccountNumber[10];
 short BookType;
 short Buy_SellIndicator;
 long DisclosedVolume;
 long DisclosedVolumeRemaining;
   }

Some of the restrictions are :

All alphabetical data must be converted to upper case before sending to the 
host.

No NULL terminated strings should be sent to the host end. Instead, fill it 
with
blanks before sending. The strings received from the host end are padded 
with
blanks and are not NULL terminated.

3. All the structures should be defined in the following manner:

Items of type char or unsigned char, or arrays containing items of these
types, are byte aligned.

Structures are word aligned; structures of odd size are padded to an even
number of bytes.


All other types of structure members are word aligned.
All numeric data must be set to zero (0) before sending to the host, unless 
a
value is assigned to it.
5. All reserved fields mentioned,should be mapped to CHAR buffer and 
initialized to
NULL.
can some one write the code with sockets involved 
I am new to this Protocol Buffer . Can u write the code for this structure 
please ?

-- 
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/groups/opt_out.