Problem with getservbyname (Ultrix-32 V3.0 (Rev 64) )

Matt Thomas thomas at mipsbx.nac.dec.com
Sat Jul 22 09:00:36 AEST 1989


> 	When I attempt to get the port address of a service using getservbyname
> the port number that is returned is the actual port number times 256 (or 
> shifted 8?) mod 65535.  I can use this number in the getservbyport and it
> returns the same port.  The true port value returns a null.  

Are you using htons to make sure your entworking software is portable between
little-endian machines (like DEC's VAX or MIPS system) and big-endian machines
like Suns?

Remember that the getXXXXbyYYYY routines return the values in host order 
and that you need to the use the hton macro's to conver it to network order
(which happens to be big-endian).
-- 
Matt Thomas                     Internet:   thomas at decwrl.dec.com
DECnet-Ultrix Development       UUCP:       ...!decwrl!thomas
Digital Equipment Corporation   Disclaimer: This message reflects my own
Littleton, MA                               warped views, etc.



More information about the Comp.unix.ultrix mailing list