伺服器獲取客戶端IP及客戶端IP變化
1.服務端獲取客戶端請求的IP等資訊request = javax.servlet.http.HttpServletRequest
request.getRemoteAddr()獲取客戶端請求IP地址
request.getRemotePort() 獲取客戶端請求埠
request.getRemoteHost() 獲取客戶端請求的合法名稱
request.getRemoteUser() a String
specifying the login of the user making this request, or
null
if the user login is not known
request.getUserPrincipal() a java.security.Principal
null
if the user has not been authenticatedrequest.getCharacterEncoding() 獲取字元編碼
2.手機每連一次4G,IP及埠都會對應變更一次
3.具有固定IP的區域網通過路由器可設定對外網的訪問路徑及埠。路由器上設定對外的埠PORT,再對映到區域網內某臺電腦A及該臺電腦的某個埠A_port,那麼外網訪問該固定IP+對外PORT時,即可訪問到A的A_port路徑上。