aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes getRemotePort(), getLocalPort() methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "getRemotePort(), getLocalPort() methods" Watch "getRemotePort(), getLocalPort() methods" New topic
Author

getRemotePort(), getLocalPort() methods

PNS Subramanian
Ranch Hand

Joined: Jul 13, 2004
Posts: 150
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
John Wolf
Ranch Hand

Joined: Feb 18, 2002
Posts: 64
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

Joined: Jul 13, 2004
Posts: 150
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

Joined: Feb 18, 2002
Posts: 64
PNS,

I still don't get any errors. Are you using J2EE 1.4 implementation?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getRemotePort(), getLocalPort() methods