[Y-devel] Proposal: message structure change

Maurice van der Pot griffon26 at kfk4ever.com
Fri Feb 27 20:43:22 GMT 2004


On Fri, Feb 27, 2004 at 09:46:43PM +0200, Alexey Boyko wrote:
> 
> May be this suggestion you like: all Y datagrams is array of uint32_t. On 
> reception, entire array is converted with ntohl, and then processed.

How about sending it in the endianness of the sender and make the endianness
known (either during handshake or in the first byte of a packet)?
That way you always do minimal reordering. 

A small overview (use fixed width fonts ;) )

                                number of times to swap      number of times to swap
                                 with choosing a fixed      with sending in endianness
                                      endianness                  of the sender
                                 (big in this example)

big sender -> little receiver              1                            1
big sender -> big receiver                 0                            0
little sender -> little receiver           2                            0
little sender -> big receiver              1                            1

My proposal saves you the worst case situation of swapping twice.

Maurice.




More information about the Y-devel mailing list









2026 © www.Y-Windows.Org - All Rights Reserved