Last active
July 21, 2020 15:07
-
-
Save clebertsuconic/81b8ce3344b14af271e4e367ea77278e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.InetAddress; | |
import java.net.InetSocketAddress; | |
public class App | |
{ | |
public static void main( String[] args ) | |
{ | |
if (args.length < 2) { | |
System.err.println("pass in host and port (number)"); | |
System.exit(-1); | |
} | |
while (true) { | |
try { | |
InetSocketAddress inetSocketAddress = new InetSocketAddress(args[0], Integer.parseInt(args[1])); | |
System.out.println(inetSocketAddress.getAddress().getHostAddress()); | |
} catch (Throwable e) { | |
e.printStackTrace(); | |
} | |
try { | |
Thread.sleep(1000); | |
} catch (Throwable e) { | |
e.printStackTrace(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment