Problem with getservbyname (Ultrix-32 V3.0 (Rev 64) )
Jeff Michaud
michaud at decvax.dec.com
Sat Jul 22 07:57:47 AEST 1989
In article <3459 at ncsuvx.ncsu.edu>, map at cscosl.ncsu.edu (Mark Parris) writes:
> 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.
From the man page:
s_port The port number at which the service resides.
Port numbers are returned in network byte order.
which is the same byte order which it should be shoved into sockaddr_in.
In order to get it in the right byte order to print out in human readable form
you need to use the ntohs() routine.
--
/--------------------------------------------------------------\
|Jeff Michaud michaud at decwrl.dec.com michaud at decvax.dec.com|
|DECnet-ULTRIX #include <standard/disclaimer.h> |
\--------------------------------------------------------------/
More information about the Comp.unix.ultrix
mailing list