Vanilla List Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [VANILLA-LIST:3131] Binary portability



On Fri, May 05, 2000 at 11:00:44PM -0400, Jeffrey Nowakowski wrote:
> Doug aka Subby is having trouble viewing Cambot recordings on Windows,
> and I suspect that the problem may be that the cambot files are not
> portable across platforms.  I don't run Windows at home so I can't
> debug it.
> 
> The code to write and read cambot files just dumps the C struct of the
> packet out/in, so I don't see how this would be portable.  But
> wouldn't there also be the same problem with network communication?
> How can Windows clients and the Unix server communicate?

This is a question of endianness not Windows vs Unix.  The netrek packets
are translated from host to network byte order before transmission.  The
recipient takes the bytestream and converts it back to its own host byte
order before using the values.

You may be getting an extra byte swap in the cambot file.  Since I haven't
looked at the server and client cambot code, I couldn't say for sure.

> Below is the question from the C faq that talks about binary
> portability.

Binary file portability deals with endianness, data type sizes, alignment,
padding, etc, etc, etc.  Fortunately for netrek, most of these issues
are avoided with the exception of endianness.

-- 
Dave Ahn <ahn@vec.wfubmc.edu>        |  "When you were born, you cried and the
                                     |  world rejoiced.  Try to live your life
Virtual Endoscopy Center             |  so that when you die, you will rejoice
Wake Forest Univ. School of Medicine |  and the world will cry."  -1/2 jj^2