• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
author & internet detective
Posts: 41081
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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


Please check your private messages about an important administrative matter first.
 
tuty sra
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey I made the required changes. thanks for your suggestion.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please check your private messages again. Thanks.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please check this.

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

I hope that will help you
 
tuty sra
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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.
 
No thanks. We have all the government we need. This tiny ad would like you to leave now:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic