Created
April 5, 2016 00:12
-
-
Save kedarmhaswade/a12c8c20f86d998474bb14d0e0b533cb to your computer and use it in GitHub Desktop.
Does Java Use the right IP version?
This file contains hidden or 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
package tmp; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.net.URL; | |
import java.net.URLConnection; | |
/** | |
* Created by kmhaswade on 3/31/16. | |
*/ | |
public class Tmp { | |
public static void main(String[] args) throws IOException { | |
URL u = new URL("http://localhost:8080"); | |
URLConnection uc = u.openConnection(); | |
uc.connect(); | |
System.out.println(System.getProperty("java.net.preferIPv6Addresses")); | |
BufferedReader br = new BufferedReader(new InputStreamReader(uc.getInputStream())); | |
String line; | |
while ((line = br.readLine()) != null) { | |
System.out.println(line); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment