1

My application is: ping host IP(in LAN) address from my machine.

InetAddress address = InetAddress.getByName("host IP address");
 boolean b=(address.isReachable(10000));

When i run that web application ping is done from my machine so in my tomcat web server this application is running but is it possible to connect host ip address from my machine but i will put my application in another machine's tomact web server, which is also in my LAN. So ping will be done from my machine but another machine will run this application.

harry
  • 731
  • 10
  • 23
  • 1
    You can fake the source IP address by creating a raw ICMP echo message and send it. However, this will make the reply go to the "fake" source instead of to you. – Some programmer dude Feb 22 '12 at 07:18
  • no no all are right IP addresses here, i cannot use fake ip address, any other suggestion please? – harry Feb 22 '12 at 07:24

1 Answers1

0

Your tomcat application would need to know your machine's IP address ahead of time. You could use a Dynamic DNS server for this such as no-ip.com

Once you have a way of reliably knowing your machines IP from your server app you would need to write a small application to run on your machine that would accept a request from your server and actually do the ping and return the results.

If you write this application in .net then you could use a WCF service configured as a SOAP endpoint on your local machine and have a method that does the ping and returns the ping output as a string.

Hades
  • 1,975
  • 1
  • 23
  • 39