Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!purdue!haven!decuac!shlump.dec.com!mipsbx.nac.dec.com!thomas From: thomas@mipsbx.nac.dec.com (Matt Thomas) Newsgroups: comp.unix.ultrix Subject: Re: Problem with getservbyname (Ultrix-32 V3.0 (Rev 64) ) Message-ID: <3675@shlump.dec.com> Date: 21 Jul 89 23:00:36 GMT References: <3459@ncsuvx.ncsu.edu> Sender: news@shlump.dec.com Reply-To: thomas@decwrl.dec.com Distribution: usa Organization: Digital Equipment Corporation Lines: 17 > 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@decwrl.dec.com DECnet-Ultrix Development UUCP: ...!decwrl!thomas Digital Equipment Corporation Disclaimer: This message reflects my own Littleton, MA warped views, etc.