简体   繁体   English

从服务器获取客户端的IP地址

[英]get IP address of a client from a server

i want to a make a software in java as in which one laptop is a server and 1 laptop is a client.The software should get the IP address and all the process running on client .from tutorials i have tried by connecting 2 laptops through LAN and check the connection by sharing a file between the two but when i am using some sort of code to get IP address of client result is null.The code i am using is Listing name of or ip of all computers on a LAN 我想用一个Java开发一个软件,其中一台笔记本电脑是一台服务器,一台笔记本电脑是一台客户端。该软件应该获得IP地址以及在客户端上运行的所有进程。并通过在两者之间共享文件来检查连接,但是当我使用某种代码来获取客户端结果的IP地址为null时,我正在使用的代码是LAN上所有计算机的ip名称或ip

kindly help me from start that how should i proceed that should i use client server setup for the connection between client and server or as i have mentioned earlier from peer to peer network can i solve my problem. 请从一开始就为我提供帮助,我应该如何继续使用客户端服务器设置进行客户端和服务器之间的连接,或者如我之前在对等网络中提到的那样,我可以解决我的问题。 Thankyou 谢谢

Following my java code: 按照我的Java代码:

String ipAddress =  request.getRemoteAddr();
System.out.println("IP Address: "+ipAddress);

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

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