I was debugging an application which opens few UDP ports. I used netstat command to find the open ports. I saw that there were couple of ports being used by my browser (in this case Firefox) when I said “netstat -anb”. Firefox just had few websites open.
Does this mean that servers redirect the browsers to other ports than what user generally think ?
Any more information on this will be greatly helpful.
There are remote port and local port. When you open a web browser and try to connect to a website. You web browser always connects to remote address at their port 80 (by default) (not your local port 80). However, before making this connection, your web browser have to tell the remote server that it will be waiting for the remote server response at a certain port number (local port) which is not used by any other application (otherwise, all other applications listening on the same port will get confused when receiving the message).
You local port number can be anything as long as it is unused. So if your firefox is making multiple connection to a remote address, it will have to open multiple ports but the single port on the remote address is enough to serve multiple connections.