[comp.lang.c] passing floats in inet socket-based IPC

luj@delta.ecn.purdue.edu (Jun Lu) (11/27/90)

I posted the query to comp.unix.questions.  I thought that the question may
boil down to the reprsentation of floating point numbers :-( and I like to hear
the comments from the C-gurus.  Follow up to comp.unix.questions.

----------
Is there a quick/neat way to passing floats in inet socket-based IPC, just
like we "routinely" do for passing ints on "popular" architectures( with
just some hton or ntoh conversions) ?

The two processes, as indicated by "inet", may run on two different
plateforms.

One very portable and safe way for passing floats is, as I can see, is to
convert floats to ascii representations before sending them
across the network and on the other end convert the ascii strings back to
floats.  But the disadvantages are that this consumes more
message space than necessary and also incurs the overhead of converisons
between ascii and floats.

Are there any better alternatives ?

Thanks for any info/pointers in advance.

--
-- Jun Lu                          Internet:luj@ecn.purdue.edu          --
-- Aeronautics & Astronautics      Bitnet:  luj%ecn.purdue.edu@purccvm  --
-- Purdue University		   UUCP:    pur-ee!luj                  -- 
-- W. Lafayette, IN 47907          Phone:317-494-9410  Fax:317-494-0307 --