Il 24/04/2015 18:12, Michael Kiwala ha scritto:
On Thu, Apr 23, 2015 at 2:53 PM, Tim Bunce <tim.bu...@pobox.com
<mailto:tim.bu...@pobox.com>> wrote:

    That approach only applies to your perl statsd, right?  For the nodejs
    or C statsd's you don't have an easy[*] a way to find the port.

I was about to suggest running `lsof -i -sTCP:LISTEN -p $PID_OF_STATSD`
in the parent after the server has been spawned, when I noticed that Tim
already mentioned the lsof option in his footnote.

Why not use lsof to query the port that was assigned?

I'm often a bit reluctant to use system commands as that
makes the whole process more OS dependent.

Even considering Win32 out of the picture, is lsof working
in the same way for every OS where perl is running?

I guess that is my only argument against it, but thanks for
suggesting it, it's certainly a valid strategy.

--
Cosimo

Reply via email to