* Problems with ntohs
@ 1991-02-18 23:17 David Goldstein
0 siblings, 0 replies; 3+ messages in thread
From: David Goldstein @ 1991-02-18 23:17 UTC (permalink / raw)
I have run into a seemingly insurmountable problem when communicating
between DEC (Ultrix) and Sun machines using TCP/IP. The two machines
reverse bytes, which is handled by the ntohs, ntohl commands. However,
I have an application sending floats. Interestingly, if one does:
printf("The value should be %f",ntohs(x));
then one gets a sort-of reasonable, predictable answer. However, if one
does:
x = ntohs(x);
printf("x is now %f",x);
then one realizes that the Vax SEEMS to do some funny things with the
high order bits, transforming a very small number into an incorrect,
large one....
any experiences or suggestions on surmounting this would be
appreciated! thanks!
david
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: Problems with ntohs
@ 1991-02-19 22:38 David Warren
1991-02-20 1:54 ` Fletcher Kittredge
0 siblings, 1 reply; 3+ messages in thread
From: David Warren @ 1991-02-19 22:38 UTC (permalink / raw)
Are we discussing VAX ULTRIX or risc ULTRIX. If your ULTRIX is on a
DECstation, you should be able to just reverse the byte order. (I
believe that NFS will even do it for you automatically). If, however,
you ULTRIX is on VAX architecture you will need to also convert
between VAX and IEEE floating point. On a DECstation there are the
routines ftoi, itof, dtoi, itod, gtoi and itog that take care of this. I
have also seen programs that run under VMS to do the same things.
There is probably someone out there that already has them under SUNOS.
--
David Warren INTERNET: warren@atmos.washington.edu
(206) 543-0945 UUCP: uw-beaver!atmos.washington.edu!warren
Dept of Atmospheric Sciences, AK-40
University of Washington
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Problems with ntohs
1991-02-19 22:38 Problems with ntohs David Warren
@ 1991-02-20 1:54 ` Fletcher Kittredge
0 siblings, 0 replies; 3+ messages in thread
From: Fletcher Kittredge @ 1991-02-20 1:54 UTC (permalink / raw)
In article <WARREN.91Feb19143825@rainbow.atmos.washington.edu> warren@atmos.washington.edu (David Warren) writes:
>Are we discussing VAX ULTRIX or risc ULTRIX. If your ULTRIX is on a
>DECstation, you should be able to just reverse the byte order. (I
>believe that NFS will even do it for you automatically). If, however,
>you ULTRIX is on VAX architecture you will need to also convert
>between VAX and IEEE floating point. On a DECstation there are the
>routines ftoi, itof, dtoi, itod, gtoi and itog that take care of this. I
>have also seen programs that run under VMS to do the same things.
>There is probably someone out there that already has them under SUNOS.
I suspect the cleanest solution to your problem is to use XDR. XDR is
avaliable, documented and supported on the Sun. XDR is available and
undocumented on Ultrix. I have no idea if DEC is supporting its use
or not. Since NCS seems to be lacking this feature (A general purpose,
standalone data conversion facility), it would be in DEC's interest to
to support XDR (which probably means they won't).
RPC/XDR is in the public domain and is floating around the net. A copy of
an implementation lives on uunet.uu.net, available for anonymous FTP.
regards,
fletcher
Fletcher Kittredge
Platforms and Tools Group, BBN Software Products
10 Fawcett Street, Cambridge, MA. 02138
617-873-3465 / fkittred@bbn.com / fkittred@das.harvard.edu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1991-02-20 1:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1991-02-19 22:38 Problems with ntohs David Warren
1991-02-20 1:54 ` Fletcher Kittredge
-- strict thread matches above, loose matches on Subject: below --
1991-02-18 23:17 David Goldstein
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox