D
Dave Thompson
True generally, but the sockets/POSIX standard {ntoh,hton}{l,s}SM Ryan wrote:
Linking in more code that may or may not be around is a bad idea. Also
"long" need not be "sizeof == 4", and indeed isn't on many platforms.
don't really mean 'long' and 'short'; they mean 'VAX long = IPv4 addr'
which is always 4 octets, and 'VAX short = IP port' which is always 2.
They are now actually defined (in POSIX/SUSv2) as uint{32,16}_t
from <stdint.h>, which is the fully-standard C99 way of saying this.
Once upon a time, briefly, enough of the world WAS a VAX.
It is portable to systems that have sockets, which is a lot.(Somehow I feel like starting to sing about rain. said:This isn't portable. And it's just "not" how to do it.
It is not maximally portable, and you can easily write
completely standard C for it which is maximally portable.
Both are valid, but only the latter is really ontopic here.
- David.Thompson1 at worldnet.att.net