Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #39733

Re: what thread or module is listening on a port?

From Martin Gregorie <martin@mydomain.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: what thread or module is listening on a port?
Date 2022-02-23 16:51 +0000
Organization A noiseless patient Spider
Message-ID <sv5on5$qcn$1@dont-email.me> (permalink)
References <slrnt1cajr.3vsm.avl@logic.at> <sv5l5b$utj$1@dont-email.me>

Show all headers | View raw


On Wed, 23 Feb 2022 10:51:06 -0500, Eric Sosman wrote:

> On 2/23/2022 7:37 AM, Andreas Leitgeb wrote:
>> Given a java process (that uses a couple of 3rd-party libs and stuff
>> from maven repo) and a TCP port number that this process is listening
>> on (for all interfaces), what options do I have for finding out, which
>> "part" of the process is responsible for the listening port?
>> 
>> Once I see, which of the umpty libraries did it, I can look for options
>> to either unconfigure it, bind to localhost, or at least understand it.
>> 
>> That's on Solaris (Unix).
>> $ netstat -aun | grep "54157.*LISTEN"     # gives me e.g:
>>        *.52634              *.*            xxx  54157 java 0      0 
>>        256000      0 LISTEN
>> [...]
>      Not a Java answer, but: Could you use dtrace to watch the
> port creations as they go by and see which piece of code instigates each
> one?  (My Solaris days are a distant memory and my dtrace skills were
> never super-keen, but it seems to me dtrace ought to be able to do the
> trick.)
> 
>      If the process opens ten thousand ports this could get
> tedious, but still ...

Try "lsof -p processid". Once the process has initialised and opened 
files and sockets etc, at the very least you'll get a list of what types 
of files have been opened and a fair idea of what each is attached to.

This is UNIX/Linux advice: I don't use Windows at all.
 

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

what thread or module is listening on a port? Andreas Leitgeb <avl@logic.at> - 2022-02-23 12:37 +0000
  Re: what thread or module is listening on a port? Eric Sosman <esosman@comcast-dot-net.invalid> - 2022-02-23 10:51 -0500
    Re: what thread or module is listening on a port? Martin Gregorie <martin@mydomain.invalid> - 2022-02-23 16:51 +0000
  Re: what thread or module is listening on a port? Arne Vajhøj <arne@vajhoej.dk> - 2022-02-23 12:15 -0500
    Re: what thread or module is listening on a port? Andreas Leitgeb <avl@logic.at> - 2022-02-24 23:04 +0000
    Re: what thread or module is listening on a port? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2022-03-19 12:47 +0100

csiph-web