简体   繁体   English

如何通过java编码在服务器上找到连接的系统?

[英]How to find the connected system on the server through java coding?

I have one java application. 我有一个Java应用程序。 That application works like getting the PC informations(Hardware and profile details). 该应用程序的工作方式类似于获取PC信息(硬件和配置文件详细信息)。 So I want to get the which system connected on the server when that application running on the server. 因此,当该应用程序在服务器上运行时,我想获得服务器上连接的系统。 How its possible? 怎么可能? I dont have about this. 我没有这个。 Give me the idea's about this. 给我这个主意。

Simply server is parent means i want to find child system's through java coding. 简单地说,服务器是父级的意思是我想通过java编码找到子级系统。

I have 3 little ideas maybe some of them can inspire you or give you some tips. 我有3个小建议,也许其中一些可以启发您或给您一些提示。

Idea 1: 想法1:

Detect and log the IP addresses and the time the users connect to your application. 检测并记录用户连接到应用程序的IP地址和时间。

Something like this i think should allow you to get the IP: 我认为应该可以让您获得IP:

public void service(HttpServletRequest req, HttpServletResponse res) 
 throws IOException {
   String ip = req.getRemoteAddr();
   Date date = new Date();
   MyLogger.log(ip,date);
  }

If req.getRemoteAddr() dont work try(The clients IP has to be somewhere on the header): 如果req.getRemoteAddr()不起作用,请尝试(客户端IP必须在标头上的某个位置):

request.getHeader("x-forwarded-for") See Link request.getHeader(“ x-forwarded-for”)请参阅链接

Idea 2: 想法2:

About knowing the type of system that is connected to the server, i think JMX can do some of that for you if the remote system allows it. 关于了解连接到服务器的系统的类型,我认为如果远程系统允许, JMX可以为您完成一些工作。 I never used it but i think you can do certain monitoring thinks with it. 我从未使用过它,但我认为您可以使用它进行某些监视。

Idea 3: 想法3:

I think the best way to detect information about the clients machine, is having an application running in that concrete client machine. 我认为检测有关客户端计算机信息的最好方法是在该特定客户端计算机中运行一个应用程序。 An applet. 一个小程序。 I am not sure about this one, but if i remember good applets execute on client side, maybe you could find the way to put one in your web-app so it can detect information about the client system easily and then forward it back to the app server.(As i said i am not sure if this is possible) 我不确定这一点,但是如果我记得在客户端执行良好的applet,也许您可​​以找到一种方法将其放入Web应用程序中,以便它可以轻松检测有关客户端系统的信息,然后将其转发回给客户端。应用服务器。(如我所说,我不确定是否可行)

Idea 4 想法4

Find third party software, maybe a web service(Some kind of advanced whois web service) that gets the info for you when you send just a parameter(exmample: Ip address) 查找第三方软件,也许是一个Web服务(某种高级Whois Web服务),当您仅发送一个参数(例如:IP地址)时,它会为您获取信息。

Update 更新资料

This api might help you: jpcap 该API可能会帮助您: jpcap

PS also having a quick look to the sockets chapter of the java tutorials, can also become handy. PS也可以快速浏览一下Java教程的sockets一章

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM