open-dis / open-dis-java

Java implementation of the IEEE-1278.1 Distributed Interactive Simulation (DIS) application protocol v6 and v7 :boom:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DIS Network Traffic on Macs

mcgredonps opened this issue · comments

The latest version of Macs, Java, and wireless networks together have an annoying problem: you'll be unable to open up any sockets from compiled application. The fix looks like this:

mvn exec:java -Dexec.mainClass=edu.nps.moves.examples.PduSender -Djava.net.preferIPv4Stack=true -Dexec.args="62040 239.1.2.3"

The solution, "-Djava.net.preferIPv4Stack=true", seems to fix Mac laptops only. What makes me wonder if that can cause any problems on Windows, which I don't have handy. If you've got a NetBeans project you can try it out with opening the project->build->run and pasting.

It seems to me that would seem to confirm that "-Djava.net.preferIPv4Stack=true" would make Windows still function.

Ah, I've hit this before too. For me I first saw it on Windows 7. It was because the network interface had both IPv4 and IPv6 enabled. One option was to turn off IPv6, the other option was to do what you did with -Djava.net.preferIPv4Stack=true

If it works as expected--it seems to be that for Windows and Linux, since we're running Java to execute--it seems not as good to get rid of from IPv6 for other applications. Somebody can install a DNS IPv6 lookup, and turning it off makes our application makes their application not work.

Is it reasonable to try the -Djava.net.preferIPv4Stack=true typed for Java applications everywhere? It's annoying, but I'm not so sure turning off IPv6 is any easier. You only do that once, but it creates application problems if you ever pop it back on that seem rather obscure.

Don, that maven command seems to run fine for me on Windows 10.

I read the Oracle docs on the java.net.preferIPv4Stack option here:

https://docs.oracle.com/javase/8/docs/api/java/net/doc-files/net-properties.html

It sounds straight forward, setting it to true will prevent connections with IPv6 clients. But for me that was never what I was trying to do. There must be some other underlying issue I was hitting that the only work around was setting it to true like you're doing now.

@mcgredonps how do you want to handle this one? should we close?