Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* 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

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-18 23:17 Problems with ntohs David Goldstein
  -- strict thread matches above, loose matches on Subject: below --
1991-02-19 22:38 David Warren
1991-02-20  1:54 ` Fletcher Kittredge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox