I’m analyzing a small LWP useragent in a loop with an HTTP analyzer and I noticed that every visit of the URL my port keeps changing.
While I have a small script also made in VB.Net httpwebrequest and that isn’t changing my port number while visiting the URL 10 times.
Is it possible to keep a static ip:port while using perl?
For the HTTP client:
If you also want to use a specific interface,
Of course, you run into problems if the port is already in use, which is likely if you just used it for another connection.
Output:
More likely, the port is not being reused, the connection is. You could also try reusing the connection by passing
keep_alive => 1to the LWP::UserAgent constructor.Output: