Skip to content

Instantly share code, notes, and snippets.

@clebertsuconic
Last active July 21, 2020 15:07
Show Gist options
  • Save clebertsuconic/81b8ce3344b14af271e4e367ea77278e to your computer and use it in GitHub Desktop.
Save clebertsuconic/81b8ce3344b14af271e4e367ea77278e to your computer and use it in GitHub Desktop.
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