0

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

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

Community
  • 1
  • 1
zeeshan nisar
  • 553
  • 2
  • 4
  • 18
  • 1
    take alook at this link.. http://stackoverflow.com/questions/16558869/getting-ip-address-of-client – tabby Feb 03 '16 at 04:59
  • Are you using jsp and servlet – KVK Feb 03 '16 at 05:02
  • If you are using TCP sockets between client and server, getRemoteSocketAddress() will return client socket IP address of at server end. – Ravindra babu Feb 03 '16 at 05:21
  • Possible duplicate of [ServerSocket + client Socket - how do I get IP address of client?](http://stackoverflow.com/questions/15421592/serversocket-client-socket-how-do-i-get-ip-address-of-client) – Ravindra babu Feb 03 '16 at 05:22

1 Answers1

0

Following my java code:

String ipAddress =  request.getRemoteAddr();
System.out.println("IP Address: "+ipAddress);
Anand Pandey
  • 383
  • 4
  • 12