These methods are in the HttpServletRequest object.
getRemotePort() – Here server is asking for the remote port. It returns the port of client. In other words the port number on the client from which request came.
getServerPort()- it says to which port was the request originally sent?
getlocalPort()- it says on which port did the request end up?