开发者

HttpServletRequest.getRemotePort()

How could a possible vendor 开发者_StackOverflow中文版implementation of HttpServletRequest.getRemotePort() get the remote port ? Is it parsed from the actual request sent ? I could not see any request headers like "Client-port", "Request-port" or the like.


The Web server receives the client's request using the normal mechanisms of TCP/IP. The client host and port are among the information that's available at that level. Having established the connection, the server packs it into the request information passed to your program.

The client doesn't send its port number, and even if it did it would be of dubious value because it would be very easy to fake for mischievous purposes. The port number is sent as part of the packets exchanged by TCP/IP stacks.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜