File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Does the webservers blocks some range of ports for its use? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Does the webservers blocks some range of ports for its use?" Watch "Does the webservers blocks some range of ports for its use?" New topic
Author

Does the webservers blocks some range of ports for its use?

tuty sra
Greenhorn

Joined: Aug 30, 2008
Posts: 16
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?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30516
    
150

Originally posted by tutysra likes coffee:
can you guys help me out?

Please check your private messages about an important administrative matter first.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
tuty sra
Greenhorn

Joined: Aug 30, 2008
Posts: 16
hey I made the required changes. thanks for your suggestion.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Please check your private messages again. Thanks.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

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.
Ashu Jain
Ranch Hand

Joined: Feb 24, 2008
Posts: 73
Please check this.

http://www.coderanch.com/t/364255/Servlets/java/difference-between-Ports

I hope that will help you
tuty sra
Greenhorn

Joined: Aug 30, 2008
Posts: 16
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
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


1. What is the total amount of ports available on a system

A port is not a physical thing, it is defined by a 16 bit unsigned integer, so 0 to 65535 are possible.

2. Can there be more ports on a system with a load balancer and many machines

No.

3. Does the browser opens a port for each page opened

No.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Does the webservers blocks some range of ports for its use?