0

I may be using my Java program (which is initialized by the simple Batch code at the bottom, which may or may not help anything). From my main computer which will connect to localhost to get to my MySql server.

I otherwise could be connecting via a laptop, which is on the same Wi-Fi network. Therefore, I believe it would use the IPv4 address. Lastly, I could connect via a completely different network and would use my IP.

How could I use Java to detect where exactly it is and change which host it will connect to while pinging the server?

    java -jar thb.jar
    pause
MWiesner
  • 8,868
  • 11
  • 36
  • 70
Twijn
  • 11
  • 3
  • icmp doesn't work that way. The **server** is the host arbitrary clients connect to, it isn't at all clear what you're asking here. – Elliott Frisch Sep 21 '16 at 03:24
  • I need to be able to connect to my MySql server which is on my computer from basically any location, weather it be via that own computer, a laptop on the same wifi, or from a completely different wifi network. If I am on a different wifi network then localhost will not work, and on the same wifi network I don't believe that using just the regular external IP will work. – Twijn Sep 21 '16 at 03:49
  • If you are using xamp, then take a look at [Access XAMPP Localhost from Internet](http://stackoverflow.com/questions/822902/access-xampp-localhost-from-internet) and if you are using wamp ,[TRY THIS](http://www.simonewebdesign.it/how-to-put-online-your-wampserver/) – Young Emil Sep 21 '16 at 04:02

0 Answers0