0

Possible Duplicate:
How can I determine the IP of my router/gateway in Java?

I would like to get router/gateway ip in java. I need some thing which is more standard like any libraries i can use. I do not want to curl any site and get the ip.

Thank you Balaji

Community
  • 1
  • 1
Balaji
  • 859
  • 1
  • 16
  • 27
  • 4
    Isn't this basically the same question as http://stackoverflow.com/questions/11930/how-can-i-determine-the-ip-of-my-router-gateway-in-java? – emory Sep 27 '11 at 23:45
  • Instead of curl some websites i would like to check is there any library in JAVA which does the function. – Balaji Sep 28 '11 at 00:24

1 Answers1

0

This looks like it will do what you want. What you really want to do is do a traceroute, which discovers each networking device in turn between you and a destination machine. Since you really only want the next hop, any outside destination will do in your case.

Note that if you know what OS this will be running on, you may be able to do this much easier and faster. For instance, you may be able to get the information you want out of the files in /etc under Linux, or by executing ifconfig.

dj_segfault
  • 11,957
  • 4
  • 29
  • 37