My new laptop (Alienware m17x) throws a java.net.SocketException: Invalid argument: connect
when I run the following basic code:
Server.java:
I have an Alienware m17x R3 and I found that I had the exact same error with Java, though I encountered it with Minecraft. Installing older Java6u33 fixed the issue but I found that newer updates of Java7 still weren't working even after waiting several months. So I eventually went to the Dell website and downloaded the most recent network drivers for my Alienware laptop (since Alienware is now owned by Dell) and that fixed the problem right away.
I have figured out a way to make this a permanent change from here.
What you need to do is add a system variable named JAVA_TOOL_OPTIONS and set this to whatever you want to be passed to java as a commandline argument whenever it starts up, in yours and my case being
-Djava.net.preferIPv4Stack=true