Is Java UDP communication broken on macOS

javaNetwork

I've been trying to figure out why a Java program that uses UDP communication on Windows works 100% fine but seems to regularly drop packets on a macOS build of the JVM (8.x).

I saw another thread on StackExchange that was never really answered, but it appears that one of the people noticed a similar issue on OSX there as well.

I don't have the standard firewall enabled in preferences nor do I believe I have any special network settings which would interrupt UDP datagrams. As well, if I run the same program on a Windows 7 VM via VirtualBox on the same hardware, the program works just fine.

Any ideas of what to look for or if this is a known issue?

UPDATE 2018-11-24: More details. I'm running Java 1.8.0_92-b14 from Oracle on a MacPro3,1 and macOS 10.13.6. The program I'm running is ADTPro 2.0.2 as an ethernet server trying to communicate with an old Apple //e that has an Uthernet II running the other side of ADTPro. It is software to transfer disk images to/from the machines.

The problem is that transfers often timeout and abort and it appears that packets are getting lost and the code isn't sophisticated enough to error correct and resend/retry. Looking at the source code, it appears everything is in UDP which definitely raises suspicions. According to the maintainer on GitHub, the fact that it is using UDP is historical and nobody has done the work to convert it to TCP. Given that the software works just fine talking to a Windows machine with the same software and Java versions, I'm guessing it is something with macOS or the OSX Java build and asking if anyone knows how to determine for sure or otherwise. Does that help?

Best Answer

No - UDP isn't fundamentally broken on macOS (or any of the other AppleOS)

The definition of UDP is unicast data packets and due to the send and forget nature of the casting, delivery of these is sometimes jokingly called unreliable data packets.

As a troubleshooting step, my first triage step would be to establish that the switch and router are actually delivering the packets to the macOS interface. Wireshark or a management tool on your network would be excellent tools to record these packets to see if they are being delivered.

I wouldn't worry about people saying TCP is more or less reliable than UDP since UDP has many technical advantages for streaming performance and you are on the correct path focusing on a specific java application that consumes data on a specific Mac in your network. Lots of your details are good, but it's kind of like detailing the pressure in the tires and the color of the paint when you actually need to know if the driver took a right down your street.

Are you able to run Wireshark and verify the packets or get access to the network logs to verify the sender and also you might need to do a little research on UDP and ask a follow on question if this actually is more about networking.