Article View: comp.unix.programmer
Article #3313Re: finding the current socket of your telnet session
From: Vic Abell
Date: Tue, 29 Oct 1996 00:00
Date: Tue, 29 Oct 1996 00:00
39 lines
1843 bytes
1843 bytes
In article <846254378.24798.0@arete.demon.co.uk> Yourname@somwhere.COM (Your Name) writes: >... > >If I log into the Unix machine from a PC running a telnet session, how >can I find the TCP address of the PC (either using shell script or C). >Finger will only give the telnet login location if known. > >... Lsof will do this with several different selections: * lsof -i @<host_name> Will report all sockets with a local or foreign address that matches <host_name>, including the local and foreign port numbers used. * lsof -c telnetd Will report all files open to all processes running the telnetd command. * lsof -c telnetd -a -i @<host_name> Will restrict output to socket files having <host_name> as a local or foreign host address and whose command name is telnetd. Normally lsof does Internet address to host name and port number to service name conversions in its output, but that can be suppressed with lsof options. Lsof is available at: ftp://vic.cc.purdue.edu/pub/tools/unix/lsof It's also available at many mirror sites. You can find a mirror site list at the indicated URL. Vic Abell <abe@purdue.edu>
Technical Details
Message-ID:
<5558g8$rmu@mozo.cc.purdue.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<846254378.24798.0@arete.demon.co.uk>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc89c,5f5b38c13e89ce7a X-Google-Attributes: gidfc89c,public X-Google-Thread: fa664,5f5b38c13e89ce7a X-Google-Attributes: gidfa664,public X-Google-Thread: 108f6a,5f5b38c13e89ce7a X-Google-Attributes: gid108f6a,public From: abe@vic.cc.purdue.edu (Vic Abell) Subject: Re: finding the current socket of your telnet session Date: 1996/10/29 Message-ID: <5558g8$rmu@mozo.cc.purdue.edu> X-Deja-AN: 192988091 references: <846254378.24798.0@arete.demon.co.uk> organization: Purdue University keywords: lsof newsgroups: comp.unix.programmer,comp.unix.sco.programmer,demon.ip.support.unix