I'm having problems with a web scraper in Ruby. I'm using Mechanize gem.
Is there any way to get the local port used in the agent connection? It would be very useful for my problem.
For instance, in TCPSockets, I can call:
2.3.3 :029 > t = TCPSocket.new
=> #<TCPSocket:fd 14>
2.3.3 :030 > t.addr
=> ["AF_INET", 45164, "127.0.0.1", "127.0.0.1"]
Here, 45164 is the port number I need.
I'd like to do something like
agent = Mechanize.new
page = agent.get "http://www.google.com/"
agent.addr
and get the local port number.
Regards.