From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,10bf95f665757cee X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1994-03-11 06:23:03 PST Newsgroups: comp.unix.osf.osf1 Path: gmd.de!xlink.net!howland.reston.ans.net!agate!news.Brown.EDU!noc.near.net!atria.com!jtk From: jtk@atria.com (John T. Kohl) Subject: Re: sin_port weirdness in DEC OSF/1? In-Reply-To: robm@ncsa.uiuc.edu's message of 10 Mar 1994 23:20:43 GMT Message-ID: Sender: news@atria.com Nntp-Posting-Host: banana.atria.com Organization: Atria Software, Inc. References: <2loa0b$sqk@vixen.cso.uiuc.edu> Date: Fri, 11 Mar 1994 14:23:03 GMT >>>>> "Rob" == Rob McCool writes: In article <2loa0b$sqk@vixen.cso.uiuc.edu> robm@ncsa.uiuc.edu (Rob McCool) writes: Rob> Hi, in the source for my information server, I need to find out what port a Rob> given socket is attached to while running under inetd. I'm finding that Rob> while my code to do this works elsewhere, it fails miserably under OSF/1, Rob> returning a very large integer (usually 20480 or 36895). Here is the code: DEC OSF/1 on Alpha AXP uses a different byte order from network byte order; getsockname() reports the address and port number in network byte order. You should use ntohs() (network to host short) to convert the value. On machines which have matching network and host byte order, the function is a null macro; on machines like the DEC Alpha AXP, it's a byte-swapping function. -- John Kohl or working for but not representing: Atria Software --------- Oh, just enjoy yourself!