Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to know which is the port used by my system on accessing a particular URL. Suppose the URL is ip_address:9081/abc Is the software port 9081 of my system is being used to access the URL? How can I identify it? Is there any command to identify the used port for a particular URL?

share|improve this question

migrated from stackoverflow.com Jan 15 '13 at 9:18

This question came from our site for professional and enthusiast programmers.

    
No, your system port is choosen randomly (from pool of free ports usually); it can be altered by routers, firewalls etc. Other system port is 9081, they are absolutely independent. –  Arvo Jan 15 '13 at 8:10
    
By "port" do you mean the local source port for the TCP connection? If so, Arvo's comment is correct. The TCP/IP stack chooses one randomly. (The application can bind to a specific port if it wishes to, but generally there's no reason to do so.) –  David Schwartz Jan 15 '13 at 8:11

1 Answer 1

No, 8081 is the port you are connecting to (in the server). To know the local port of the connection (wich usually is random in high values of the port range) exec netstat command when you have a connection stablished (works in windows, and unix-like systems.)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.