• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getRemotePort(), getLocalPort() methods

 
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tried finding out the client port number used in a servlet using getRemotePort() - gives a compilation error. Also, getLocalPort() doesnt seem to work while getServerPort() works. Am i missing something here ?

Env. Tomcat5.0.30/Win XP
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
PNS,

I don't have any problems with it. I used it in a filter as a test. Can you include the code here?
 
PNS Subramanian
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The following is the code that i had used - i override the service method in my servlet that extends HttpServlet.
The lines have been commented since it resulted in a compilation error otherwise.


Besides, what ever the action method other than POST i specify in my jsp page calling this servlet, the first log statement gives me an output of GET.Don't understand why it works this way.
 
John Wolf
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
PNS,

I still don't get any errors. Are you using J2EE 1.4 implementation?
 
reply
    Bookmark Topic Watch Topic
  • New Topic