locked0wn has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

In the past I have posted a question about assigning a src port for LWP to use before sending out a request. I have a similar question. I want to know if it is possible to ask LWP what SRC port it is going to use just prior to sending out a request. Is there any way to do this?

Also, is there a way to ask LWP the IP address of the host it communicated to. It's a single image collection, and if I know what port it is going to use, I can lock tcpdump on the transaction for collection of raw traffic.

As always, thank you for information!!

Replies are listed 'Best First'.
Re: Questions about LWP`
by Anonymous Monk on Dec 11, 2010 at 23:56 UTC
    I want to know if it is possible to ask LWP what SRC port it is going to use just prior to sending out a request. Is there any way to do this?

    Yes, there is a way, but no, you don't want to do this, its just busy work. What you want to do is instruct tcpdump (or wireshark... ) to monitor your programs network traffic.

      Thank you for the response, but I can't find any information as to locking traffic collection with TCPDUMP or Tshark onto a PID, for program specific traffic collection. If you don't mind, a link, or option would be greatly appreciated. Wireshark is not the way I want to go, since I want to automate the whole process. I have several LWP agents that will be running on given system at the same time. If I can ask LWP what src port it is about to use, then I can spin up a tcpdump session against that src port, no matter where it is going. So, while asking LWP what SRC port it is going use prior to sending may be considered busy work, I have a very good reason for asking. If I were running only one process, then it wouldn't be a problem. I sincerely appreciate your help. Many thanks in advance.
        I have a very good reason for asking...

        Remember your previous question about choosing a port? If you chose the port, then you know ahead of time which port it is :)