🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.dec
Article #3149

Problems with ntohs

#3149
From: David Goldstein
Date: Mon, 18 Feb 1991 23:17
19 lines
1090 bytes
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
Technical Details
Message-ID: <1991Feb18.231746.20132@evax.arl.utexas.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!evax!goldstn

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!evax!goldstn
From: goldstn@evax.arl.utexas.edu (David Goldstein)
Newsgroups: comp.sys.dec
Subject: Problems with ntohs
Message-ID: <1991Feb18.231746.20132@evax.arl.utexas.edu>
Date: 18 Feb 91 23:17:46 GMT
Distribution: usa
Organization: Computer Science Engineering Univ. of Texas at Arlington
Lines: 19