如何在grails中找到Connected Clients IP地址 [英] How to find out Connected Clients Ip Address in grails

查看:199
本文介绍了如何在grails中找到Connected Clients IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个关于grails的小项目。我试图在这个项目中添加网络概念,请指导如何使用它。

要求: -


我在我的本地主机上运行我的项目(http:// localhost:8080 / xyz)。因此,如果另一个人使用相同的本地主机访问项目(http ://192.168.xx:8080 / xyz)。通过使用网络概念,我应该得到那些使用相同本地主机(IP地址)的特定用户IP地址的详细信息。




目前我正在使用这个查询来获取我系统的IP地址

$ $ p $ $ $ $ $ $ $ $ {request.getScheme()}:$ {InetAddress.getLocalHost()。getHostAddress()}

我想要在网络中使用这个项目的特定用户的IP地址。



请指导我解决这个问题。

解决方案

您应该可以使用:

  String addr = request。 [R emoteAddr 


I am doing small project on grails. I am trying to add networking concepts in this projects can u please guide how to work on it

Requirement:-

I am running my project in my localhost(http://localhost:8080/xyz).So if another person is accessing the project with the same localhost(http://192.168.x.x:8080/xyz).By using the networking concept i should get the details of that particular users ip address who using with the same localhost (IP address).

currently i am using this query to get IP address of my system

${request.getScheme()}:${InetAddress.getLocalHost().getHostAddress()}

but i want IP address of particular user who are using this project in network.

please guide me to solve this problem.

解决方案

You should just be able to use:

String addr = request.remoteAddr

这篇关于如何在grails中找到Connected Clients IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆