Finding out the port

How can a running Rails application tell what port it's listening on?
Say I start the app with 'mongrel_rails -p 3002' and want a page to say
"I'm listening on 3002", how would I do that?

In your controller:


There’s also: => “localhost”
request.host_with_port => “localhost:3000”


Thank you. I realised I should have asked a different question. Is
there a way to get at the port number independently of a specific
request? For example, if I want to set something in environment.rb in a
way that depends on the port number.