Your code is rather similar to what I already do, with just some slight differences . For example instead of global variables I use static ones as already pointed out, and I don't use two different byte arrays for the data treatment.

Quote Originally Posted by ccoder
One quick question about the longs and integers in your UDT; are they big-endian (aka network byte order)? If so, you will need to use the API functions to convert to little-endian. You can see this in the DataArrival code in the above link. The C app that the code in the link connects to runs on another platform that is big-endian. Java, by default, converts values to big-endian. We always send values in big-endian and leave it to the receiving end to convert accordingly.
Yes, I have to, and already, make big<->little conversions.