Re: Network byte order and floating-point numbers

From: Owen Jacobson (angstrom_at_lionsanctuary.net)
Date: 06/14/04


Date: Mon, 14 Jun 2004 16:26:51 GMT

On Sun, 13 Jun 2004 17:53:42 +0200, Reinder Verlinde wrote:

> In article <pan.2004.06.07.01.35.23.59926@lionsanctuary.net>,
> Owen Jacobson <angstrom@lionsanctuary.net> wrote:
>
>> the actual protocol is based on sending struct{...}s over the connection.
>
> If you mean that you write sizeof( aStruct) bytes, passing a pointer to
> aStruct: that is not even portable between equal-endian systems.
> Different systems, compilers or even compiler settings will lead to
> different padding inside structures.

I'm well aware of that. Unfortunately, the guys involved in writing the
server half of the application are very much Windows people, where this is
normal behaviour and even works reasonably well (between Windows machines).

Sigh.

>> Is there a standard binary format/byte ordering for sending
>> floating-point numbers over a network connection
>
> Your best bet probably is to use a text-based format.

If I could rewrite the request format I would've done it already. I'm
just stuck writing a client application on linux. It's the right answer,
but I can't apply it.

> Second-best, but possibly good enough would be a IEEE floating point
> format. Study your compilers to see whether they support it. You will
> still have to do do endian conversion.

That's what I was hoping. Thanks.

Owen

-- 
Some say the Wired doesn't have political borders like the real world,
but there are far too many nonsense-spouting anarchists or idiots who
think that pranks are a revolution. 


Relevant Pages

  • Re: Interpretation of literal reals
    ... Do note, however, that in f77 this does *NOT* apply to internal I/O, as used in your example. ... List-directed formatting is not allowed for internal files in standard f77, and there used to be f77 compilers that didn't do it. ... In cases where the input data is always generated by a formatted write, I might relent and allow the same format to be used for reading, even though it has something other than ".0". ...
    (comp.lang.fortran)
  • Re: Many small programs vs. one large program?
    ... code format, etc... ... format, not the input or output data files... ... many compilers, I believe Intel's are among them, ... Many DEC-heritage compilers, including CVF and IVF, allowed "tab ...
    (comp.lang.fortran)
  • Re: reading variably sized floats
    ... the nX or An) format field specifier. ... While that is a likely behavior with most compilers, ... it is *NOT* behavior specified by the standard. ... number of replacements blanks, or the definition of tab points, to be ...
    (comp.lang.fortran)
  • Re: OpenVMS I64 Compilers (was: Re: Intel to chip away at Itanium prices <- or ... )
    ... :object files as UNIX, so keeping the compilers current should be a lot ... OpenVMS is using the Intel Itanium Executable and Linkable Format ...
    (comp.os.vms)
  • Re: Reading BMP graphic file
    ... expects record markers. ... but is BMP really a text file format? ... but it has many portability complications and is best avoided. ... compilers have some extension for the purpose. ...
    (comp.lang.fortran)