hi, I have read that the server listens on a port and handles the request to a different port when the request arrives. There are methods which get these port values request.getServerPort() request.getLocalPort() and there is also a method request.getRemotePort() which means the browser also open a port for every page opened? I am really confused about this. If a server and browser reserves a set of ports for themselves, what are those range of ports? what are the ports which are safe to be used in our program? what is the total number of ports which are available in a system? I haven't got answers to all these questions in the book. can you guys help me out?
Yes, a server can listen on one port then respond on another, but that has nothing to do wit hthe methods you are looking at.
An application listens on a port and IP, typically the port is port 80. Often there is something between the initial request and the application server, eg a web server, load balancer or something, and requests eventually get forwarded to the app server.
The app server may not be listening on port 80, therefore the local and remote ports could be different.
hi, I could get some information from your replies and the links you gave but, still I need some clarifications 1. What is the total amount of ports available on a system 2. Can there be more ports on a system with a load balancer and many machines 3. Does the browser opens a port for each page opened