Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* sin_port weirdness in DEC OSF/1?
@ 1994-03-10 23:20 Rob McCool
  1994-03-11  4:16 ` Rob McCool
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rob McCool @ 1994-03-10 23:20 UTC (permalink / 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>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1994-03-11 14:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-03-10 23:20 sin_port weirdness in DEC OSF/1? Rob McCool
1994-03-11  4:16 ` Rob McCool
1994-03-11  7:42 ` Peter Brouwer
1994-03-11 14:23 ` John T. Kohl

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