Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!lll-winken!cert!netnews.upenn.edu!msuinfo!convex.cl.msu.edu!jap From: jap@convex.cl.msu.edu (Joe Porkka) Newsgroups: comp.unix.wizards Subject: Re: Given a filedescriptor, how can I find source IP?? Message-ID: <1991Mar26.170837.110@msuinfo.cl.msu.edu> Date: 26 Mar 91 17:08:37 GMT References: <1991Mar22.201818.25515@msuinfo.cl.msu.edu> <1991Mar23.041824.3130@msuinfo.cl.msu.edu> <1991Mar26.064131.24485@mtxinu.COM> Sender: news@msuinfo.cl.msu.edu Organization: Michigan State University Lines: 22 ed@mtxinu.COM (Ed Gould) writes: >>Remember boys and girls, "getpeername()" only works on sockets. >>I guess I was not clear - the program does not open a socket - >>it inherits some filedescriptors (0 1 and 2). >A program can inherit sockets, just as it can inherit files. "File" >descriptors can refer to either. If you're asking about the child >of a telnet session - which has pseudo-terminals connected to 0, >1, and 2 - then you are out of luck. In general, there is no way Yes, it would seem to not be possible. It *oughta* be! Well, we have come to a pretty workable solution to the problem. It turns out that in SunOS3.x, inetd by default passed the ip address as a command line arg to in.telnetd. In SunOS4.1 they "fixed" it so that it does not. However, you can turn that feature back on by editing inetd.conf So, with that feature back on, I just gotta look at my parents (in.telnetd) command line args to get the IP address.