• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Ports Problem  RSS feed

Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,
I am having some port issues in my application.The router has been set such that any request to port 80 goes to the web server and for some ports it comes to the server on which my application is hosted.And,I need to extract the port number on which the request was made and generate the response accordingly.I am using getServerPort() right now in my application.So,if the user sends a request say for instance,
I need to extract the 1234 part in my servlet and generate the response.When I test that from some places it works and from some places it doesn't works properly.Actually,I read the getServerPort() and getlocalPort() definitions:

Can someone please elaborate me...when to use which one??Your help would be really appreciated.
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you need to know the port numbers? - there might be another way around your problem.

If you are using a NAT router, you might have problems with using NAT - can you configure the webserver to proxy requests to your server by virtual host?

You might try posting this in "Sockets and Internet Protocols"
I want my playground back. Here, I'll give you this tiny ad for it:
Become a Java guru with IntelliJ IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!