Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: robm@ncsa.uiuc.edu (Rob McCool)
Subject: sin_port weirdness in DEC OSF/1?
Date: 10 Mar 1994 23:20:43 GMT	[thread overview]
Message-ID: <2loa0b$sqk@vixen.cso.uiuc.edu> (raw)


Hi, in the source for my information server, I need to find out what port a
given socket is attached to while running under inetd. I'm finding that
while my code to do this works elsewhere, it fails miserably under OSF/1,
returning a very large integer (usually 20480 or 36895). Here is the code:

int get_portnum(int sd,FILE *out)  {
        struct sockaddr addr;
        int len;
    
        len = sizeof(struct sockaddr);
        if(getsockname(sd,&addr,&len) < 0)
            die(SERVER_ERROR,"could not get port number",out);
        return(((struct sockaddr_in *)&addr)->sin_port);
}

Does anyone see anything wrong with this? Is this a bug in OSF/1, or a
mistake on my part which just happens to work on other systems? If it's an
OS bug, does anyone have a workaround?

This seems to happen with both OSF/1 1.2 and 1.3.

--
Rob McCool, robm@ncsa.uiuc.edu
Software Development Group, National Center for Supercomputing Applications
It was working ten minutes ago, I swear...
<A HREF="http://hoohoo.ncsa.uiuc.edu/~robm/sg.html">A must see.</A>


             reply	other threads:[~1994-03-10 23:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-03-10 23:20 Rob McCool [this message]
1994-03-11  4:16 ` sin_port weirdness in DEC OSF/1? Rob McCool
1994-03-11  7:42 ` Peter Brouwer
1994-03-11 14:23 ` John T. Kohl
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox