|
Home > Archive > Unix Programming > August 2007 > (POSIX?) Machine independent data passing?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
(POSIX?) Machine independent data passing?
|
|
| Alan Woodland 2007-08-20, 7:25 pm |
| Hi all,
I was hoping someone here could jog my memory - If I recall correctly
there is a (possibly POSIX?) set of fairly standard functions that were
designed to assist serialising datatypes (int/float?) for transmission
over a network or storage regardless of the endianness/floating point
representations. Did I just wishfully dream this? I can't seem to find
it anywhere any more, but I'm sure I remember reading the manpage once
by accident and thinking it would come in handy in the future!
Thanks,
Alan
| |
| Barry Margolin 2007-08-20, 7:25 pm |
| In article <1187652321.759102@leri.aber.ac.uk>,
Alan Woodland <ajw05@aber.ac.uk> wrote:
> Hi all,
>
> I was hoping someone here could jog my memory - If I recall correctly
> there is a (possibly POSIX?) set of fairly standard functions that were
> designed to assist serialising datatypes (int/float?) for transmission
> over a network or storage regardless of the endianness/floating point
> representations. Did I just wishfully dream this? I can't seem to find
> it anywhere any more, but I'm sure I remember reading the manpage once
> by accident and thinking it would come in handy in the future!
I think you're thinking of XDR, the serialization format and API used
with Sun RPC.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
| |
| Logan Shaw 2007-08-21, 1:34 am |
| Alan Woodland wrote:
> Hi all,
>
> I was hoping someone here could jog my memory - If I recall correctly
> there is a (possibly POSIX?) set of fairly standard functions that were
> designed to assist serialising datatypes (int/float?) for transmission
> over a network or storage regardless of the endianness/floating point
> representations.
Do you mean htons(), ntohs(), htonl(), and ntohl()?
I don't know of any floating-point analogs. This might be because in
the old days there was more variation in the representation of floating
point numbers (compared to integers) and thus values on one platform
couldn't necessarily be represented exactly (or even closely) on other
platforms.
- Logan
| |
| Ivan Gotovchits 2007-08-21, 1:34 am |
| Alan Woodland wrote:
> Hi all,
>
> I was hoping someone here could jog my memory - If I recall correctly
> there is a (possibly POSIX?) set of fairly standard functions that were
> designed to assist serialising datatypes (int/float?) for transmission
> over a network or storage regardless of the endianness/floating point
> representations. Did I just wishfully dream this? I can't seem to find
> it anywhere any more, but I'm sure I remember reading the manpage once
> by accident and thinking it would come in handy in the future!
>
> Thanks,
> Alan
I know nothing except `htons', `htons', `ntohs', etc ..
What concerning float and double, they can be translated with the above
functions. But I am not sure really.
| |
| Alan Woodland 2007-08-21, 7:22 am |
| Barry Margolin wrote:
> In article <1187652321.759102@leri.aber.ac.uk>,
> Alan Woodland <ajw05@aber.ac.uk> wrote:
> I think you're thinking of XDR, the serialization format and API used
> with Sun RPC.
Thanks, that's exactly it! It looks like it's actually an RFC too, so
might be supported outside of the Sun world.
Thanks,
Alan
| |
| Ben Bacarisse 2007-08-21, 1:21 pm |
| Alan Woodland <ajw05@aber.ac.uk> writes:
> Hi all,
>
> I was hoping someone here could jog my memory - If I recall correctly
> there is a (possibly POSIX?) set of fairly standard functions that were
> designed to assist serialising datatypes (int/float?) for transmission
> over a network or storage regardless of the endianness/floating point
> representations. Did I just wishfully dream this? I can't seem to find
> it anywhere any more, but I'm sure I remember reading the manpage once
> by accident and thinking it would come in handy in the future!
There is also the rather heavy-weight ISO ASN.1. Probably not what
you were thinking about, but t has its place...
--
Ben.
| |
| Logan Shaw 2007-08-22, 1:23 am |
| Alan Woodland wrote:
> Barry Margolin wrote:
[vbcol=seagreen]
[vbcol=seagreen]
> Thanks, that's exactly it! It looks like it's actually an RFC too, so
> might be supported outside of the Sun world.
I haven't exactly gone mucking around with NFS internals, but it's my
understanding that NFS uses XDR / RPC. So any system that implements
NFS would have it. That would include quite a lot of systems.
- Logan
|
|
|
|
|